I'm beating my head against a wall here. I'm working on integrating Field Maps and the Survey123 app to update our one of our data collection workflows. Monitors will enter a point, line, or polygon in Field Maps, click a link in the pop-up which will send them to the survey which is stored in a related table in the hosted feature service.
I've got an an Arcade script that will give a url to collect new monitoring notes and tie it to the feature by passing the feature GlobalID to a GUID field in the table if no existing record is found (which works great). What I'm struggling with is getting Survey123 to open an existing entry for editing. I'm trying to get it to find an existing monitoring note record by querying the GUID field for the related feature's GlobalID. The only query I can get to work on the table is the table's GlobalID field for an ID that I manually paste in: "q:GlobalID": '56bc00cb-4c8d-4e60-8553-a87dd98697cd', will open survey123 with that particular record opened for editing. Nothing else will work. When I click the link to edit a record, it just takes me to my inbox and shows all the entries. If I go too wild with trying to create a where= query shown in the Integrating with other apps page Survey123 gives me a code 400 error for invalid parameters.
Here's the script:
var urlsource = 'arcgis-survey123://?';
var mon_note = FeatureSetByRelationshipName($feature, 'monitoring_notes',['point_guid'], false)
var mon_count = Count(mon_note)
if (mon_count==0) {
var recmess = Text("Create New Record");
var params = {
itemID: 'c50d6e4981aa4919a06da9c37d121f95',
action: 'collect',
"field:point_guid": $feature["GlobalID"]
};
} else {
var recmess = Text("Edit Existing Monitoring Notes");
var params = {
itemID: 'c50d6e4981aa4919a06da9c37d121f95',
action: 'edit',
"q:point_guid": $feature["GlobalID"], <--Here's where I'm stuck. This is what I want to do, query the point_guid field in the related table for a match to the parent feature's global ID.
folder: 'inbox',
update: 'true'
};
}
var fullURL = urlsource + UrlEncode(params);
return {
type: 'text',
text: `<p> <a href="${fullURL}" target="_blank">${recmess}</a></p>`,
//this property supports html tags
}