Custom Survey123 URL with Field Maps Callback

4053
12
Jump to solution
02-01-2022 05:39 AM
erica_poisson
Occasional Contributor III

Hi - 

I am migrating some workflows from Collector to Field Maps and I am running into issues with my callback URL parameters.

The workflow:

  1.  Click a polygon feature in Field Maps to view pop-up. Custom pop-up displays URL to launch Survey123 form and pass certain attributes to Survey123. 
  2. Survey is completed by user. When user submits survey, Field Maps re-opens via callback to specified map. 

This worked very well with Collector and was simple to configure. With Field Maps, I am getting some weird errors, even though I am following the documentation on both Survey123 and Field Maps help pages. 

If I use a URL formatted like below, I get an error when attempting to open Survey123 from the URL. The error is in Survey123 and says "Error Unpacking":

 https://survey123.arcgis.app/?itemID=10242016ba5b4ab3883bf40bb8ae76fb&field:Ag_Guid={GlobalID }&callback=https://fieldmaps.arcgis.app /?referenceContext=open&itemID=6b34dffb1c0b41b3907c61a97d0b1e4a

This same error occurs when I modified the URL to be something like this:

https://survey123.arcgis.app/?itemID=10242016ba5b4ab3883bf40bb8ae76fb&field:Ag_Guid={GlobalID}&callback=https://fieldmaps.arcgis.app://?referenceContext=open&itemID=6b34dffb1c0b41b3907c61a97d0b1e4a  

https://survey123.arcgis.app/?itemID=10242016ba5b4ab3883bf40bb8ae76fb&field:Ag_Guid={GlobalID}&callback=https://fieldmaps.arcgis.app//?referenceContext=open&itemID=6b34dffb1c0b41b3907c61a97d0b1e4a

If I use the callback URL without the referenceContext parameter included, the callback seems to work, but does display an on-screen error when returning to Field Maps; this happens with either of the formats below:

https://survey123.arcgis.app/?itemID=10242016ba5b4ab3883bf40bb8ae76fb&field:Ag_Guid={GlobalID }&callback=https://fieldmaps.arcgis.app ://?itemID=6b34dffb1c0b41b3907c61a97d0b1e4a

https://survey123.arcgis.app/?itemID=10242016ba5b4ab3883bf40bb8ae76fb&field:Ag_Guid={GlobalID }&callback=https://fieldmaps.arcgis.app /?itemID=6b34dffb1c0b41b3907c61a97d0b1e4a

Error:

erica_tefft_0-1643722751457.png

 

I did check and the Survey123 data submits properly. I am returned to the proper map in Field Maps, but see this error each time. 

Does anyone have advice on how to resolve this issue?

Thank you,

Erica
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

I am able to reproduce the issue on both iOS and Android when the callback URL is not encoded. Once it's encoded, it works correctly.

For example:

 

arcgis-survey123://?portalUrl=https://www.arcgis.com&itemID=6e9276bfdf164a2bafa236f40a1eb4f8&callback=https://fieldmaps.arcgis.app/?referenceContext=open&itemID=1223e990f9314fe996fb6e69eefab9a9

 

Results in the Error Unpacking message in Survey123.

But the following works since it's URL encoded.

 

arcgis-survey123://?portalUrl=https://www.arcgis.com&itemID=6e9276bfdf164a2bafa236f40a1eb4f8&callback=https%3A%2F%2Ffieldmaps.arcgis.app%2F%3FreferenceContext%3Dopen%26itemID%3D1223e990f9314fe996fb6e69eefab9a9

 

 All you have to do is copy the callback URL and run it through an online encoder like https://www.urlencoder.org/ and use the result in your app link URL.

It's always recommended to encode parameters if they contain special characters like "&".

View solution in original post

12 Replies
by Anonymous User
Not applicable

Have you tried URL encoding the callback parameter?

There's a couple examples in the doc about it.

GeorgiannaStrobin
New Contributor II

We are having the exact same issue. We have several linked Survey123's and Field Maps. We set up the latest link on January 6, 2022 and it was working fine at that time. It was brought to our attention today that a user was having problems, so we went in to see if we could replicate his issue and discovered that now all of our linked apps are broken. We tried the same things as above with the URLs and are getting the same results.

Did something change on Esri's end? How do we solve this issue?

Thank you!

0 Kudos
himalaya_GIS
New Contributor II

We are also getting the same error message in Andriod devices and in ios it doesn't even open the field map from Srvey123

Thank you

0 Kudos
by Anonymous User
Not applicable

I am able to reproduce the issue on both iOS and Android when the callback URL is not encoded. Once it's encoded, it works correctly.

For example:

 

arcgis-survey123://?portalUrl=https://www.arcgis.com&itemID=6e9276bfdf164a2bafa236f40a1eb4f8&callback=https://fieldmaps.arcgis.app/?referenceContext=open&itemID=1223e990f9314fe996fb6e69eefab9a9

 

Results in the Error Unpacking message in Survey123.

But the following works since it's URL encoded.

 

arcgis-survey123://?portalUrl=https://www.arcgis.com&itemID=6e9276bfdf164a2bafa236f40a1eb4f8&callback=https%3A%2F%2Ffieldmaps.arcgis.app%2F%3FreferenceContext%3Dopen%26itemID%3D1223e990f9314fe996fb6e69eefab9a9

 

 All you have to do is copy the callback URL and run it through an online encoder like https://www.urlencoder.org/ and use the result in your app link URL.

It's always recommended to encode parameters if they contain special characters like "&".

erica_poisson
Occasional Contributor III

Hi @Anonymous User  - I will test this to see if it fixes my issue.

If this is the recommended way of doing this, I would recommend an update to the documentation available on the Field Maps and Survey123 help pages because it is not clear at all. 

Thank you,

Erica
0 Kudos
erica_poisson
Occasional Contributor III

@Anonymous User -

This is the encoded URL I am using - Survey123 launches from Field Maps just fine, but the callback doesn't  happen. I submit the Survey and am returned to the Survey123 home instead of Field Maps. 

Any advice would be useful.

arcgis-survey123://?portalUrl=https://www.arcgis.com&itemID=10242016ba5b4ab3883bf40bb8ae76fb&field:Ag_Guid={GlobalID}&callback=https%3A%2F%2Ffieldmaps.arcgis.app%20%2F%3FreferenceContext%3Dopen%26itemID%3D6b34dffb1c0b41b3907c61a97d0b1e4a

Thank you,

Erica
0 Kudos
by Anonymous User
Not applicable

@erica_poissonIt looks like you have a space in your callback URL after ".app" and before "/". This seems to be causing the issue. I took your app link and plugged in a different survey id and it never returned to Field Maps. I then removed the space (which is encoded to "%20") and tried again and then it worked as expected.

erica_poisson
Occasional Contributor III

Thank you! I did not notice that, or know that %20 corresponded with a space. I appreciate the help. I do think a blog or something on this would be helpful for others though. 

Erica
CatherineHall678
New Contributor II

This post really helped my troubleshooting...was having the same issue. Much appreciate you @Anonymous User . And thank you @erica_poisson for pursuing and even posting some examples. 

0 Kudos