q:queryparameter URL parameter for Survey123 Windows and iOS

2158
13
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.

 

13 Replies
JimW
by
Occasional Contributor

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

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