Pass attribute field as URL parameter

2818
12
Jump to solution
02-15-2022 08:45 AM
PaulPetersen1
Occasional Contributor

I am attempting to launch Field Maps from Survey123 via URL parameter and pass attributes from Survey123 into a specified feature in Field Maps using the using the Field Maps referenceContext=updateFeature method.

The problem is that I can't figure out how to pass a specified attribute from Survey123 as a URL parameter. This is easy to do going from Field Maps to Survey123, but not so much going the opposite direction.

Basically I've got an guid attribute called Pole_Key in Survey123 that matches the GlobalID of a point feature in the Field Map. I want to use that Pole_Key to open and edit the corresponding record in Field Maps. How do I pass the Pole_Key attribute as a URL parameter from Survey123?

Tags (3)
0 Kudos
12 Replies
AndrewPadilla
Occasional Contributor
Here would be a more dynamic expression:
 
var itemID = 'xxxxxx'; // Replace with your Survey123 item ID
var field = 'Pole_Key'; // Replace with the appropriate field name
var attributeName = 'RetrofitStatus'; // Replace with the desired attribute name
var attributeValue = '2'; // Replace with the desired attribute value

var survey123UrlSource = 'arcgis-survey123://?itemID=' + itemID + '&field:' + field + '=' + $feature.globalid + '&callback:submit=';
var fieldMapsUrlSource = 'https://fieldmaps.arcgis.app?';
var fieldMapsParams = 'itemID%3D' + itemID + '%26referenceContext%3DupdateFeature%26featureSourceURL%3Dhttps://services1.arcgis.com/xxxx/arcgis/rest/services/xxxx/FeatureServer/0%26';
var featureGlobalID = Mid($feature.globalid, 1, 36);
var featureAttributes = '&featureAttributes=' + URLEncode('{"' + attributeName + '":"' + attributeValue + '"}') + '%0A';

return survey123UrlSource + URLEncode(fieldMapsUrlSource) + fieldMapsParams + 'featureID=' + featureGlobalID + featureAttributes;
0 Kudos
YannickCabana
New Contributor

Thank you DougBrowning for your answer.

For Field Maps layer,

In Pro, I see the globalID in lower case but with brackets and in AGOL, I see it without brackets.

Is there a solution to manage the callback from Survey to Field Maps even if the globalID from Field Maps is in lower case? Or if there is no solution?

Thank you!

0 Kudos
DougBrowning
MVP Esteemed Contributor

AGOL just hides the brackets but they are there.  It is for sure confusing that Pro, AGOL, ArcMap, 123 and Field Maps are all different.  I have a bug with support on it.

If you are generating the URL with arcade I have seen people use Upper() or Lower() to convert it.  If not Arcade then no I do not know.  In theory GUID does not care but I am seeing it care at times which is weird and a big pain for sure.

Sorry all i got.

0 Kudos