I'm struggling to get something that should be really simple working.
I'm viewing the feature layer from a Survey123 survey in Field Maps. I want to have a link in the popup in field maps that opens Survey123 with the currently viewed record opened in it.
I've used a similar feature to open an existing record in the web form to edit with no trouble but wasted hours fighting with this and can't get it to work.
I've reviewed the documentation:
https://doc.arcgis.com/en/survey123/get-started/integrate-launchfieldapp.htm
I've read the two forum posts I can find that were releated:
I've tried it with update, even though I don't want to have it update. I want to assume the user already has up to date infomation in their inbox. (we are using inbox for this Survey)
I've tried it with q:where=globalId=<GlobalID> & q:globalId=<GlobalID>
Solved! Go to Solution.
If the survey isn't on the device and you don't have update = true, nothing will open.
The simplest way to do this is create an Arcade expression, encode your parameters, and then embed the expression into the link text.
var urlsource = 'arcgis-survey123://?';
var params = {
// survey ID goes here
itemID: 'xxxxxxxxxxxxxxxxxxxxxxx',
action: 'edit',
'q:globalId': $feature.GlobalID,
folder: 'inbox',
// update = true means the inbox record will be refreshed. Commented out as you don't want it
// update: 'true',
// optional callback to field maps.
// callback: 'https://fieldmaps.arcgis.app'
};
return urlsource + UrlEncode(params);
Not sure if it is just Field Maps or 123 also but you had to take the {} out of globalid. I posted some links to this a few days ago. Search and you will see it. Try that.
I think this is the post you're referring to:
It doesn't look like it applies here. He was trying to open something in field maps not survey123. And the url i'm generating doesn't have any { in it.
Are you trying to open the web form or the app?
The app uses this URL
arcgis-survey123://?itemID=21297afb7&field:PlotID={PlotID}
I'm wanting to use a link in a popup in field maps Phone App to open Survey123 Phone app and have that item opened automaticlly for the user. (We're viewing the feature layer that Survey123 created for this survey in field maps but it has repeats so they can't edit it directly in field maps, I need to link them back to it in Survey123).
Thanks for the suggestion, the documentation shows https://survey123.arcgis.app but I tried it anyway and it gives the same results, Survey123 opens to the inbox list, but doesn't open the record I've passed in the globalid for.
Adding some additonal infomation/weirdness.
The URL I'm generating works. But not when arcade generates it..
I used the arcade script below, and when I view the popup on a web browser if I copy the link address and inspect it looks perfect. If I add a text section to my popup and include a link using that exact URL my arcade script generated that I just copied to create a static link when I view the popup in Field Maps on my phone the manually craeted link works. And the arcade generated one only goes to the inbox list, doesn't open the survey. Both these URLs should be exactly the same. My only though it field maps is interpreting my arcade script differently than it's being done in my web browser but I can't long press the links in field maps on my phone to copy the URL to inspect.
I'll have to look closer at the URL encoding bit from one of the posts I linked originally as that seems to be my problem here.
Here is my code from arcade to generate the link:
I have seen posts on this before in the Field Maps forum for sure. I think it was taking out the {} and they had code for that. Like this one https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-updatefeature-url-parameter/m-p...
What I do is just use Arcade for part of the URL like this and put that in a custom popup.
arcgis-survey123://?itemID=90500a4223bb4&field:EvaluationID={expression/expr0}
If the survey isn't on the device and you don't have update = true, nothing will open.
The simplest way to do this is create an Arcade expression, encode your parameters, and then embed the expression into the link text.
var urlsource = 'arcgis-survey123://?';
var params = {
// survey ID goes here
itemID: 'xxxxxxxxxxxxxxxxxxxxxxx',
action: 'edit',
'q:globalId': $feature.GlobalID,
folder: 'inbox',
// update = true means the inbox record will be refreshed. Commented out as you don't want it
// update: 'true',
// optional callback to field maps.
// callback: 'https://fieldmaps.arcgis.app'
};
return urlsource + UrlEncode(params);
Thank you so much @ChristopherCounsell !! I really appreciate the help with this, with your code I was able to get it working.
It does seem to be bugged and only work if update is set to true, but I expected that would likely be the case based on what I'd found searching the topic.
For anybody who comes across this in the future I had to make a small change to Christopher's code to achive what I was looking for:
var urlsource = 'arcgis-survey123://?';var linktext = 'Link to Survey123';var params = {// survey ID goes hereitemID: 'xxxxxxxxxxxxxxxxxxxxxxxxxx',action: 'edit','q:globalId': $feature.GlobalID,folder: 'inbox',// update = true means the inbox record will be refreshed. Commented out as you don't want itupdate: 'true',// optional callback to field maps.callback: 'https://fieldmaps.arcgis.app'};return {type : 'text',text : '<a href="' + urlsource + UrlEncode(params) + '">' + linkText + '</a>'}
Hi Everyone,
Wondering if you may be able to help me with this topic.
I have a feature layer where the parent is a polyline and the related table is a point.
Thanks to this post I was able to successfully add a URL to edit individual records in the related table.
Unfortunately I can not figure out how to do the same thing for the parent layer. I set up the URL hyperlink with your code above and it takes me to the main inbox in the correct form but does not load the result. I thought it would work in much the same way as it did for the related layer, by passing the GlobalID in the parent layer.
I've seen a couple of posts like this Passing Parent GlobalID to Survey123 using Custom ... - Esri Community
Has anyone been through this process to allow editing of both parent and related layers?
Josh