q:queryparameter URL parameter for Survey123 Windows and iOS

4481
16
Jump to solution
12-02-2020 04:23 AM
JamieLambert
Occasional Contributor III

Hi All,

Does anyone have a working example of using the q:queryparameter URL parameter to launch Survey123 (Windows or iOS/Android) [edit] from a pop-up and open an existing survey for editing? So far my attempts get me as far as the Inbox, but I cannot load the form with a specific record to edit. I’m assuming that this parameter can be used this way!

The q:queryparameter "Queries the feature layer for an existing record. It can be used to retrieve content that is not on the device." So I should be able to have nothing preloaded in the Inbox.

The example in Integrate with other apps  is q:objectIds=12. I assume this could be q:objectId={objectID} (not sure if 'objectIds' is a typo in the web page?) or even better q:globalID={globalID}.

This is what I have so far and it doesn't work. I have tried a few variations around these with no success (I did also try ObjectID).

I had no issue with creating the URL to open a specific survey in edit mode in the web. The app version is just not working for me. If anyone could provide a working example or point out what I am doing wrong I would very much appreciate it.

Thanks, Jamie.

 

16 Replies
JimW
by
Occasional Contributor II

What did end up using for the query parameter in constructing your URL?  I am attempting to do the same thing and can't get the query parameter correct.  I can't figure out how the query parameter in line 5 needs to be constructed to get the inbox to open to the specific record.  Thanks!

var urlsource ='arcgis-survey123://?';
var params = {
  itemID:'d27d6fc327754039b87a62eae3042092',
  action:'edit',
  q:'globalid='+$feature.GlobalID,
  folder:'inbox',
  update:'true'
};
return urlsource  + UrlEncode(params);

 

0 Kudos
Skyler
by
New Contributor III

In line 5, you need to specify that there is a query parameter q:globalId with the value $feature.GlobalID. What you've specified above is a query parameter q with the value 'globalid='+$feature.GlobalID. Try this instead:

var urlsource = 'arcgis-survey123://?';
var params = {
  itemID: 'd27d6fc327754039b87a62eae3042092',
  action: 'edit',
  'q:globalId': $feature.GlobalID,
  folder: 'inbox',
  update: 'true'
};
return urlsource + UrlEncode(params);

Note that the property name q:globalId must be enclosed in quotes since it contains a special character other than _ and $. Also note that I've capitalized the I in q:globalId to match what's shown in the documentation; I believe you have to capitalize the query parameter that way, regardless of the capitalization of you actual global ID attribute.

JimW
by
Occasional Contributor II

I don't think I was ever going to figure out the correct syntax for the query parameter.  I didn't see any of that in the help.  Maybe it's there and I just missed it.  Thank you for the help!  It worked like a charm!

0 Kudos
FrancisCorbett
New Contributor II

Is there a way of getting this to work offline? I've tried using the filter and query parameters with globalid, but if I download an offline area in Field Maps and download the Survey123 form and refresh the inbox, I get a Code 0 error in Survey123 when offline.  I suspect this is because I'm using update=true. My Arcade popup:

 

var urlsource = 'arcgis-survey123://?';
var params = {
  itemID: <itemID>,
  action: 'edit',
  'q:globalId': $feature.GlobalID,
  folder: 'inbox',
  update: 'true',
  callback: 'https://fieldmaps.arcgis.app'
};
return urlsource + UrlEncode(params);

 

 Thanks in advance!

0 Kudos
RobertAnderson3
MVP Regular Contributor

Thank you so much @Skyler for this it got my link working! I had been struggling so much with it, honestly still not entirely sure what was wrong in mine vs what you had that made it work but hey.

You do need the update=true to open the record, even if it was already in the Inbox of the device in question, which is odd but sure.

The issue I'm running into now though is that this works only if the record is in the INBOX, if the record happens to be in the SENT folder of the device, it does not find the record and cannot open it.

Any insight on this part? I guess I could just turn off the sent folder to avoid this issue but it still seems kind of silly.

I guess for my work flow I'll probably need a second survey form with the same submission URL so only my supervisors can see and edit via the Inbox, and leave the other workers to just their sent folder. Hopefully this works the same way then.

0 Kudos
Skyler
by
New Contributor III

I'm glad it helped!

It's been quite a while since I've used Survey123, so unfortunately I don't have any insight into your issue with records in the Sent folder. If you haven't yet, I would probably try using the filter parameter along with folder=sent or folder=*, but I can't remember if I ever got the filter parameter working.

RobertAnderson3
MVP Regular Contributor

All good, thank you for the advice on that, I will look into it! Maybe that * idea will work, or I can try that newer Overview folder too.

Permissions wise I may need the second survey anyways so it might not be critical either.

EDIT: Okay, so I got it working!

https://survey123.arcgis.app/?itemID={itemID}&update=true&action=edit&folder=*&filter=globalId:{glob...

Had to add the folder=* and then the filter=globalId: and that seemed to get it working with surveys from the sent and inbox, which is awesome.

0 Kudos