Collector (Aurora) Custom Expressions in Custom URL Scheme Error

04-11-2019 07:44 AM
New Contributor II

I am writing a campsite collection form that uses Collector and Survey 123. I set this up using Arcmap's custom URL scheme. The user can select a site in collector and two links are included in the pop-up. One says Resurvey Campsite the other says Survey New Site. The resurvey link has a rather lengthy URL that attempts to pre-fill many of the fields of survey123. This worked other than the attributes that I had custom expressions to set correctly. The final bit the resurvey link sends the coordinates of the campsite using another custom expression.

Unfortunately, the custom expressions would work on my desktop, but when I opened collector on the iPad issued to me, they would not. I posted on this issue and was informed that Collector Aurora would support custom expressions in the URL link. I signed up for the beta and had fair success with the iPad. Some custom expressions still didn't send but coordinates did, and they were the most important one to work.

Now that Collector (Aurora) is officially out, I went out and field tested the two apps to discover that custom expressions are once again not working on my iPad or Samsung Galaxy phone. I am curious is this is a known issue and can be fixed or not, as it is rather pivotal that I can at least send the coordinates of the point to Survey 123. Below is my custom URL scheme for the resurvey link and the steps I went through to test if the custom URL was truly the issue

Resurvey Campsite Link - (&center={expression/expr2} is the non-functioning part)


Resurvey Campsite Link Output on Desktop


Expression/expr2 - Code to calculate geometry

function metersToLatLon(mx, my) {

   var originShift = 2.0 * PI * 6378137.0 / 2.0;

   var lon = (mx / originShift) * 180.0;

   var lat = (my / originShift) * 180.0;

   lat = 180.0 / PI * (2.0 * Atan(Exp(lat * PI / 180.0)) - PI / 2.0);

return [lat, lon];


var poly = Geometry($feature);

var result = '';

if (!IsEmpty(poly)) {

   var latlon = metersToLatLon(poly.x, poly.y);

   result = Round(latlon[0], 6) + ', ' + Round(latlon[1], 6);


return result;

Process for Testing Error

  • After noticing the error in the field, I retested each device in the office

     Desktop (Success)                          iPad (Error) - Newest Collector App             Android (Error) - Beta App

  • I then created a third link that only included the code to send the coordinates and tested it on each device

    Link - arcgis-survey123://?itemID=1284e4815d4c4995b5809f1a51a83f9f&center={expression/expr2}

    Desktop (Success)                       iPad (Error) - Newest Collector App             Android (Error) - Beta App

  • Finally, I created one more link that sent a fixed coordinates instead of using the custom expression

Link - arcgis-survey123://?itemID=1284e4815d4c4995b5809f1a51a83f9f&center=34.734837%2C%20-83.916739

     Desktop (Success)                       iPad (Success) - Newest Collector App             Android (Success) - Beta App

Thank you for anyone who has made it this far, I would really appreciate any help on resolving this bug as I'm super excited about using Collector and Survey 123. Good work!

10 Replies
Esri Regular Contributor

Thanks for your write up.  In a different context (ArcGIS Pro) I have noticed that in some instances the geometry function will return values in the coordinate system of the source data, while in others it returns values in the coordinate system of the map.  I mention this because your result difference  -9331888.963170711 vs. -83.829785  Is what I have seen while using a similar expression in ArcGIS Pro - Labeling vs. Popup vs. Calculation - same expression yields different results.  It would appear that there is something in the webmap use case that triggers similar inconsistencies.

0 Kudos