Select to view content in your preferred language

Opening mobile surveys from pop-ups causing unpacking loop

2393
14
03-25-2024 08:14 AM
leahmaps
Frequent Contributor

Hi Everyone,

I have been having this issue for a few weeks now while I have been testing a new survey, and I am not sure what to do to fix it.

In my pop-up, I have two links. One opens the survey in the browser, the other on mobile (as this survey is so big, opening it in an iPad browser doesn't work well). Whenever I try to click the link that would open the survey in the (iPad) Survey123 app, it causes a loop between downloading and unpacking the survey. 

Does anyone have a solution to this? I found a similar posting here, but this survey is private to the organization, and this post is from a few years ago. Nothing seems to solve the problem..

I attached a video, caution watching if you are sensitive to flashing.

14 Replies
ChristopherCounsell
MVP Frequent Contributor

You can't specify the globalid for editing, it's not how the inbox works. Field parameters aren't supported in the inbox. Globalid isn't supported as a field to pass through at all.

You need to apply a query parameter like:

q:globalId=1d392670-33e2-456d-8435-7fad3abd8bb9

e.g. 
https://survey123.arcgis.app/?itemID=exxxccxxxe344548897736ff73029495&mode=edit&q:globalId=de63aef4-...

You should also URL encode the request.

Try using this instead, then adding the expression as a link value in the text editor.

// Set app to open
var urlsource = 'arcgis-survey123://?';

// Set parameters
var params = {
  // item id of survey form
  itemID: '<item_id>',
  // parameters to pass (note no field values work in edit/inbox mode)
  // edit = inbox
  action: 'edit',
  // inbox query, will only return one record if it exists
  'q:globalId': $feature.GlobalID,
  // inbox folder
  folder: 'inbox',
  // refresh inbox
  update: 'true',
  // optional call back to ArcGIS Field Maps
  callback:'https://fieldmaps.arcgis.app'
};
// Combine the app + parameters
return urlsource + UrlEncode(params);

 

0 Kudos
leahmaps
Frequent Contributor

Hi Christopher,

The URL parameter the other way did work. When you clicked the link in field maps, the inbox had a search for {globalID} = 'whatever the global id was'. Yours did work better as it just did open the survey directly.

However, in my rendition of the expression, the itemID would switch based on the status of the feature class. If it is active, it opened one survey, if it is closeout, it opened another. Is that something that can still be done using this expression?

0 Kudos
ChristopherCounsell
MVP Frequent Contributor
Yes, add your var if statememt before the survey parameters then put the
itemid variable in instead of a hard coded itemid string
0 Kudos
LindsaySpencer-Henderson
Emerging Contributor

@JamesTedrick @Ismael can you help with this? I am experiencing the exact same thing as @Lea. Using Connect version 3.23.48, and calculating the URL scheme to include fields from a featureset. Arcade is below. I can open the survey just fine when opening in any browser (Chrome/Safari), however when updating the URL to open in the S123 app, I get this DL and unpacking loop that I cannot figure out. Have tried both with  "update to the latest survey" on and off. Have also played around with Inbox (which shouldn't make a difference but I wanted to test anything I could think of!).

Please assist! Its suuuuper bizarre behavior, and I have been using these URLs for years and this is the 1st time I have encountered this kind of behavior (both IOS and Android).

 

Arcade here:

var loc = $feature.MXLOCATION;
// Access the "WORK ORDERS" table in the map
var fields = ['LOCATION','WONUM','DESCRIPTION','STATUS'];
var plans = OrderBy(Filter(FeatureSetByName($map, 'WORK ORDERS', fields, false),"LOCATION = @loc"),'WONUM DESC')
/////

 
//SET CARIABLES TO HOLD HTML
var planList = ``
 
//LOOP THROUGH TO GET COUNTS FOR CORRECT POPUP HEADING
if (Count(plans) >= 1){
        planList = `<div style = "background:lightgray"><h3>Open Work Orders</h3>`;
    }
    else {
        planList = `<div style = "background:lightgray"><h3>No Active Work Orders</h3>`;
    }

//LOOP THROUGH AND GET LINKS FOR EACH WO#
for(var p in plans){
    if (Count(plans) >= 1){
    var desc = p.DESCRIPTION
    var wonum = p.WONUM
    var locs = p.LOCATION
    var status = p.STATUS
    var key = "WO# " + wonum + " - " + status + ":" +TextFormatting.NewLine +desc
//    var src="https://survey123.arcgis.app?"
//    var link = "itemID=8fa4f5a4e39e4eaa8f5442d2f176cc25?field:DESCRIPTION=" + desc + "&mode=edit" +"&field:MXLOCATION=" + locs + "&field:WONUM=" + wonum  + "&field:RO_STATUS=" + status + "&callback=https://experience.arcgis.com/experience/35e7c7330c9f46ec990c2c793c99xxxx"
  var sublink = "https://survey123.arcgis.com/share/8fa4f5a4e39e4eaa8f5442d2f17xxxx?field:DESCRIPTION=" + desc + "&mode=edit" + "&field:MXLOCATION=" + locs + "&field:WONUM=" + wonum  + "&field:RO_STATUS=" + status + "&callback=https://experience.arcgis.com/experience/35e7c7330c9f46ec990c2c793c9xxxxx"
//    var sublink = src + UrlEncode(link)
        planList += `<p><b><a href = "${sublink}" style ="color:blue">${key}</a></b></p>`;
        }
    }

 
planList += `</div>`
return {
    type : 'text',
    text : planList//this property supports html tags
}
ChristopherCounsell
MVP Frequent Contributor

Mode=edit is the url paremeter for the web app.

You should be using action=edit AND adding a query parameter for the inbox if using the field app.

https://doc.arcgis.com/en/survey123/get-started/integrate-launchfieldapp.htm

Field parameters are not supported when using the URL to pass values to the inbox. It can only open the existing values.

0 Kudos