Survey123 Integration - Populate Custom Attribute Fields in the Assignments Layer

2204
9
Jump to solution
03-22-2021 01:03 PM
TylerBragg2
Occasional Contributor II

Hello!  I'm trying to do something that I thought was possible, but I'm having some trouble getting it to function correctly.

I created a new Workforce Project, then added some custom attributes to the "Assignments" layer to capture some additional information about the assignment.  Once I added the additional attribute fields, I created a survey in Survey123 Connect based off this existing feature layer (assignments).  My plan was this:  Set up the Survey123 App Integration with Workforce.  When the worker opens his/her assignment, he/she can fill out the usual information that Workforce allows, then click the "survey at assignment" button, launch the survey, then add the additional attribute information via Survey123.  What I'm finding is that when I launch the "survey at assignment" and submit the survey information, another feature is added to the assignments layer instead of editing the current feature.  I've tried adjusting the URL parameters in the "Assignment Integrations" table, as I've done with Collector/Field Maps to open a survey to edit attributes, but to no avail.  Nothing I've tried to adjust seems to be permitting me to add data to the additional attributes in the assignment layer.  It just keeps adding new features in the assignments feature layer.  

My question is this:  Is it possible to use the Survey123 Integration from the Workforce assignment to update custom attributes about the assignment feature?  In other words, I want to add data to the custom attribute fields for the Workforce Assignment feature that the worker is currently viewing in Workforce.  

I have no problems launching Survey123 to edit attributes of an existing feature in Field Maps or Collector, and I wouldn't think this would be significantly different.  One difference I see is that when I set this up in Collector/Field Maps, I design my URL parameters to open the Survey123 web form, not the Survey123 app.  One reason for this is that in order to edit the existing attributes of a feature using the survey, it has to be opened up in edit mode ("mode=edit" in the URL Parameters), and I believe that the Survey123 app does not support this functionality.  So another question could be: Can you open the Survey123 web form, instead of the Survey123 app, from Workforce?  Looking at the URL parameters in the Assignment Integrations table, it is set by default to open up in the Survey123 app, indicated by the beginning part of the URL parameter of https://survey123.arcgis.app?.  I'm wondering what would happen if I change the beginning of the URL reference to https://survey123.arcgis.com/share/ .  

Any help/suggestions would be appreciated.  Thanks. 

Tyler

1 Solution

Accepted Solutions
CraigGillgrass
Esri Regular Contributor

Tyler,

Yes, it is possible to change the url scheme that Workforce uses to call Survey123 to launch the web form instead of the mobile app.  You can hand edit the url scheme in the Assignment Integrations table.  Here's an example:

https://survey123.arcgis.com/share/<itemID>?mode=edit&globalid={GlobalID}

 

However, be aware that, since you're editing the same assignment feature in Workforce as you are in Survey123 - in order for this workflow to be successful - before opening Survey123 any outstanding edits to the Assignment must be sync'd first.  

And, once returning to Workforce - you need to perform another sync to ensure that you Workforce has the latest edits you made from Survey123 perform you make any edits to the assignment in Workforce.

If these syncs aren't performed, you risk overwriting or losing data.

You'll want to walk through this workflow and ensure there's no data being overwritten.

View solution in original post

0 Kudos
9 Replies
CraigGillgrass
Esri Regular Contributor

Tyler,

Yes, it is possible to change the url scheme that Workforce uses to call Survey123 to launch the web form instead of the mobile app.  You can hand edit the url scheme in the Assignment Integrations table.  Here's an example:

https://survey123.arcgis.com/share/<itemID>?mode=edit&globalid={GlobalID}

 

However, be aware that, since you're editing the same assignment feature in Workforce as you are in Survey123 - in order for this workflow to be successful - before opening Survey123 any outstanding edits to the Assignment must be sync'd first.  

And, once returning to Workforce - you need to perform another sync to ensure that you Workforce has the latest edits you made from Survey123 perform you make any edits to the assignment in Workforce.

If these syncs aren't performed, you risk overwriting or losing data.

You'll want to walk through this workflow and ensure there's no data being overwritten.

0 Kudos
TylerBragg2
Occasional Contributor II

@CraigGillgrass , 

Thanks for your response!  While I was waiting for a response to my initial post, I did some experimenting with changing the URL parameters to open the web map, just as you described above, and it seems like it's working.  However, there is a bit of variation to the syntax that you listed above in order to make it work.  It looks like this:


https://survey123.arcgis.com/share/<ItemID>?mode=edit&globalId=${assignment.globalid}

 

I received an error stating that the GlobalID parameter was not property defined if I just used the "globalId={GlobalID}" syntax.  I can try to reset the URL parameters and generate the error if you need a screenshot.  

In my preliminary testing, I did discover the issue with syncing that you mentioned above.  That prompts a question:  Is there a way to "disable" the offline capability of Workforce with this new version so that syncing is not required?  Or is that built in now in such a way that it cannot be disabled?  That will be really annoying for the field worker if they have to keep re-syncing the assignment every time they make edits.  I don't really need the offline editing capability in my situation, and it would be an advantage if I could disable it.  The ability for offline editing is also causing an issue with my worker map - I have an image service that doesn't appear to be compatible with syncing, and if that image service is in the map it does not display properly.  That's another issue I have to resolve.  Thanks for all your help!

0 Kudos
CraigGillgrass
Esri Regular Contributor

Tyler,

Your syntax is correct, the example I gave was for another project where the GlobalID was being passed in. In your case, you can reference the assignment.globalid since you're editing the same feature.

"Is there a way to "disable" the offline capability of Workforce with this new version so that syncing is not required?"

  • There is not - Workforce works offline only and does not support a mode to work connected against the feature layer.

"That will be really annoying for the field worker if they have to keep re-syncing the assignment every time they make edits."

  • The Workforce app will sync the edits for the worker automatically every 60 sec; when there are local edits outstanding for the worker.  In your case however, you want to ensure that any pending edits are sync'd prior to launching Survey123 so that, when the worker opens the survey in Survey123, they are editing against the feature in the feature layer with those edits.

Craig

 

0 Kudos
TylerBragg2
Occasional Contributor II

Craig, 

Thanks for the explanation and your fast responses.  One additional question:

If the worker makes edits (either in Workforce or to the integrated survey) and immediately closes the app, when does Workforce sync?  The next time they open the app?  

0 Kudos
TylerBragg2
Occasional Contributor II

@CraigGillgrass ,

One other thing I did notice when I changed the URL parameters to open the web app in edit mode - The Workforce project settings page is showing an error for the Survey123 app integration.  See the screen shot below:

 

TylerBragg2_0-1616588872374.png

I don't know if this will really be an issue or not, but it does tell me that the URL scheme for the web app in edit mode is technically "not supported."

0 Kudos
CraigGillgrass
Esri Regular Contributor

Tyler,

"If the worker makes edits (either in Workforce or to the integrated survey) and immediately closes the app, when does Workforce sync?  The next time they open the app?  "

  • By closes the app, I'm assuming you mean force kills the app (e.g. swipes up on iOS). In this case, no, the pending edits are not sync'd.  If you're thinking of something else, please let me know.
  • Workforce performs a sync when a project is opened - so any pending edits that are local, will be sync'd

"One other thing I did notice when I changed the URL parameters to open the web app in edit mode - The Workforce project settings page is showing an error for the Survey123 app integration.  See the screen shot below"

  • This is by design - the URL scheme for the web app in edit mode is not possible to configure OOTB and therefore, is technically not supported. However, as long as you are following the documented guidelines for Survey123 and how to construct the URL scheme, it should work.

Craig

0 Kudos
TylerBragg2
Occasional Contributor II

Craig, 

Regarding "closing the app" - Yes, that's what I mean.  Kill the app by swiping up on iOS or choosing the "recently used apps" button on Android and ending all applications.  Our workers do NOT leave any ArcGIS field apps (Workforce, Field Maps, Survey123, etc) open on their devices.  It kills the battery life of the device.  So they make it a habit of doing what they need to do, then closing the app.  But you answered my question.  In my case, theirs should sync edits when they open the app up again, which is problematic, if I'm trying to see what they've done from the office.  They might not open it back up for hours.  So they'll have to add that extra "manual sync" step before they close so the edits will be synced as soon as they finish editing.  That's something I could see being easily forgotten by field staff... 

Thanks again for your help Craig.  I consider this matter answered and closed.  

0 Kudos
CraigGillgrass
Esri Regular Contributor

Tyler,

Happy to help.  FWIW - we are planning to support the editing of additional fields in both the web and mobile apps, once the Workforce capability is added to Field Maps. That should really simplify this workflow. We're currently planning that work for later this year.

"So they'll have to add that extra "manual sync" step before they close so the edits will be synced as soon as they finish editing.  That's something I could see being easily forgotten by field staff"

  • Unfortunately, that is a common problem.
  • When the app is force killed, we're not given any notice or capability to perform a sync or notify the user. The best way to address this is the approach you're taking - make it part of their SOP.

Craig

0 Kudos
TylerBragg2
Occasional Contributor II

Craig, 

That's good news - supporting the editing of additional fields in a simpler manner.  I think that will really make Workforce more broadly useful, especially for situations like mine where we HAVE to collect additional information about each work order.  I'm actually planning on using Feature Reports in Survey123 to take this workflow one step further and generate a "Work Order Report" PDF that highlights the work that was completed for each work order/assignment.  In our scenario, we have to report work of a certain assignment type to higher level of government, so I'll use Integromat to watch this feature layer for features of that assignment type that are completed.  When they are, I can have it automatically run a workflow to generate the feature report and upload it to our cloud servers.  Then we will have it ready when it's time to send the report up the chain.  It would be nice to bring that Feature Report service into Workforce.  I think a work order report is probably a common requirement.  Maybe I'll see if that's in the ideas section.  

0 Kudos