Understanding Survey123's custom URL Scheme

197926
359
07-29-2016 11:14 PM
IsmaelChivite
Esri Notable Contributor
60 359 197K

.Updated August 10, 2020 (Added reference to Arcade UrlEncode operation)

The purpose of a URL scheme is to provide a well-known protocol for apps to communicate with each other. Through a custom URL scheme you can remotely launch apps and invoke actions in them.  Specifically, the URL scheme in Survey123 allows you to:

  • Launch the Survey123 app
  • Open a survey
  • Prepopulate answers in the survey

A common practical scenario for using the Survey123 custom URL scheme is integrating Survey123 with other ArcGIS apps like Explorer, QuickCapture, Collector or even your own web mapping apps. Take for example a case where you want field users to use a map to identify a particular asset, and then use a smart form in Survey123 to capture information about that particular asset. Explorer, Collector or a plain Web Map can serve the first purpose.


In this post I will first describe the syntax of the Survey123 custom URL scheme, then how to execute a call with it and later how to integrate URL scheme calls into feature popups in ArcGIS Web Maps, so other ArcGIS Apps can leverage it.

About the Survey123 Custom URL Scheme syntax

A call to Survey123 through its URL Scheme looks something like this:

arcgis-survey123://?itemID=89bc8c7844e548e09baa3aad4695e78b&field:AssetID=FF34001&field:Status=Good&center=43.567,-117.380


Let’s break it down:


The first bit is pretty obvious: arcgis-survey123:// invokes the Survey123 mobile app. For this to work, the Survey123 app must be installed in the device in which the call is being made.


Everything after arcgis-survey123:// are optional parameters that you can pass if you want the app to do additional things. The list of parameters starts with a question mark (?).


Parameters are separated from each other through ampersands (&). Each parameter is actually made of two parts: the parameter name and the parameter value, which are separated by the equal (=) sign.  The rules for how to properly pass parameters are common to how you build query strings for the web.


The itemID parameter (itemID=89bc8c7844e548e09baa3aad4695e78b) refers to the survey you want to open. If the survey is not already in the device, the app will attempt to download it automatically. 

To obtain the proper itemID for a survey follow these instructions:

1.    In a web browser, login into survey123.arcgis.com
2.    Click on the survey for which you want the itemID
3.    Now get the ID of your Form from the location bar of your browser.

For example, if the URL of your survey looks like this:

  http://survey123.arcgis.com/surveys/3d02eec41a224902ab4c44e6d39319c8

, the itemID will be: 3d02eec41a224902ab4c44e6d39319c8

The app will automatically attempt to download the survey as specified in the itemID parameter.  If the survey is shared publicly, it will open right away.  If the survey is private, it will be downloaded using the currently logged-in user. If no user is logged-in, a dialog will prompt the user for credentials.


In the example above we use the field:AssetID and field:Status parameters to prepopulate questions in the survey.  If you want a survey to open and have some or all questions already answered, you will add as many field parameters as needed. Field parameters always are prefixed with the word field:  After that, you enter the name of the actual question for which you want to set the answer, then you add an equal sign and the answer. For example:

  • field:AssetID=FF34001 will populate the AssetID question in your survey with the value FF34001.

Here are some tips when passing field  parameters:

  • The value to insert immediately after field: is the value of the corresponding NAME question in your XLSForm. Do  not pass the Label!
  • The value to insert after the equal (=) sign is the actual value that will be stored in the feature service. If you are working with select_one type of  questions this is very relevant, since the value you must pass is that of the XLSForm Name of the choice, rather than its Label.
  • Passing field parameters for questions within a repeat or attachments is not supported at the moment.
  • If you would like to prepopulate a question, but do not want to user to change its value, flag the question in the XLSForm as read-only.


The last parameter we pass in the example above is center=43.567,-117.380.  This will set the location of geopoint questions in your survey at the provided coordinate pair. You must pass a latitude-longitude pair in decimal degrees separated by a comma as no other coordinate systems or formats are supported.


Invoking a Custom URL Scheme call: The Basics


If you would like to give this a quick try, I recommend that you use a web browser to experiment. Start by downloading the Survey123 app into your desktop. You can download it for Windows or for your Mac. Once you have the app, manually launch it and login to download a couple of surveys. Then get the itemID of one of them to start and use it to adjust the itemID parameter:  arcgis-survey123://?itemID=insert your own Form item ID here Then paste it into your web browser to launch Survey123 and open one of the surveys you downloaded. Continue experimenting by pre-populating survey questions.


Once you feel comfortable with the syntax of your URL scheme links, try in your own device. Start by e-mailing the URL Scheme invocation to yourself, and using it from your device's web browser. You can also use Survey123 URL scheme strings to configure hyperlinks in an email, or include them as part of a web page.


Invoking a Custom URL Scheme call from a Web Map


Things get pretty interesting when Survey123 URL scheme links are used within an ArcGIS Web Map. This allows you to integrate Survey123 into other ArcGIS apps, by allowing users to launch Survey123 from the popup of a Web Map in Collector, Explorer or even a web application. This gets interesting for a couple of reasons:

  • First, you can use a map centric app to help the user find a particular asset or location, then easily launch Survey123 from that app to capture data using a smart form.
  • Second, you can use the existing attributes of a feature in the map and pass them into the form to prepopulate answers. This is extremely useful to ensure, for example, that the unique ID of an asset as identified in your map, is passed into Survey123.

To embed custom URL scheme calls within a Web Map, you will want to edit the popup of an existing layer. Choose the Configure Pop-up option in the layer’s menu.

Next, select the Custom Attribute display as shown in the next screenshot.
 


In a Custom Attribute display you can now embed your Custom URL scheme call as a hyperlink. You can ignore the warning indicating that the value is not valid.  If you prefer, you can also work directly using the source HTML view of the popup.
 


As shown below, you can reference attributes from the underlying feature in your Survey123 custom URL scheme by enclosing the name of the feature attribute within curly brackets.


 arcgis-survey123://?itemID=89bc8c7844e548e09baa3aad4695e78b&field:AssetID={assetid}


With this technique, you will be populating the AssetID survey question with whatever value is present in the assetid attribute of the feature’s popup. This will ensure that captured data in Survey123 can always be associated back into the feature selected in the map.

A few quick tips when creating popups:

  • When passing text attributes with spaces, you will want to use the urlencode ArcGIS Arcade function. Otherwise, your links may get cut off at the first space encountered.
  • Field names are case sensitive in iOS. Ensure  you reference your feature service fields with the exact capitalization used in the feature service.
  • If you want to pass lat/lon values from attributes in your feature, be aware that the default formatting rules for the double data type cut-off decimal values to two. You will want to adjust the formatting rule to pass all decimal values to Survey123.

   1) Open the 'Configure pop-up dialog of your feature layer's and then select 'Configure Attributes' .
   2) Now select the attributes with your latitude and longitude values and pick the number of decimals you want to include in the Format drop-down option in the right side of the dialog.

  • If you want to pass lat/lon values from the geometry in a feature, you can add an Attribute Expression to your popup do dynamically get the lat/lon values from the geometry of your feature.

   1) Open the 'Configure pop-up dialog of your feature layer's and then select 'Configure Attributes'.
   2) Add a new Attribute Expression.
   3) Look for Geometry under the Globals tab and fetch Geometry($feature).x
   4) Use the Edit link at the top to give your expression a friendly name
   5) Repeat steps 2 through 4 to create a second expression for the y coordinate.


Once your Web Map is ready, you can next use it within multiple applications such as ArcGIS Explorer, Collector as well as your own web mapping apps.

Tip: Check Announcing a handy tool to generate Survey123 URLs if you would like to automate the generation of Survey123 Custom URLs for us in popups.

Invoking a Custom URL Scheme programmatically


In a web app or website, simply create an HTML link:

<a href='arcgis-survey123://?itemID=89bc8c7844e548e09baa3aad4695e78b'>Launch Survey123</a>

In QML AppStudio for ArcGIS:

Qt.openUrlExternally('arcgis-survey123://?itemID=89bc8c7844e548e09baa3aad4695e78b')

In Java, using Android's Intent:

PackageManager manager = mContext.getPackageManager();

Intent i = manager.getLaunchIntentForPackage(
"com.esri.survey123");
i.setData(Uri.parse("arcgis-survey123://?itemID=89bc8c7844e548e09baa3aad4695e78b"));
startActivity(i);

[This post was updated on October 30, 2018]

359 Comments
MatteoDe_Minicis
Deactivated User

Hi Mike, all

I've already tried adding a "$"  but it doesn't work.

My intent is to open a Survey123 having some fields prepopulated filling them from another Survey123 form (non explorer or web app popup.

I don't now how to address to the value contained in a field of the callling Survey form.

Using [], it  assumes [QCPC] as a value, using {} it doesn't recognize the hyperlink:

Is there a way to address a field present in the calling Survey form ?

Thanks, matteo

by Anonymous User
Not applicable

Matteo,

We do currently apply the custom URL schema to achieve the Passing of attributes from one Survey123 form into another Survery123 form. The custom URL schema is created from within a "note" field that uses the concat() function; within the "calculation" column of the form, to create the URL Hyperlink that will invoke the transfer of data and opening of the second Survey123 form. You have to make sure that the fields match between the two surveys. For example if you have a "select_one" question that you are passing information from form 1, then you will need to have the same setup within the second form; at least this is my experience.

This is one of the live concat() functions that we use to pass vital measurements of endangered bats from one form to another; I replaced the itemID though.

concat('<a href="arcgis-survey123://?itemID=XXXXXXXXXXXXXXXXXXXXXXXXXX&field:ProjectNumber=',${ProjectNumber},'&field:Roost_Tree_ID=',${Roost_Tree_ID},'&field:BC_Net_ID=',${BC_Net_ID},'&field:BatSpecies=',${BatSpecies},'&field:Age=',${Age},'&field:Sex=',${Sex},'&field:Reproductive=',${Reproductive},'&field:FrequencyNumber=',${FrequencyNumber},'&field:BC_Date=',${BC_Date},'">Link to Roost Tree Survey</a>')

As you can see there is a lot going on with this concat() function, but keep in mind that at the end of this process you need to match not only the custom URL schema, but also the hyperlink formatting also.

I would try this -

1). Create a note field within your survey.

2). Within the "name" field type "QCP_Link"; include the underscore.

3). Within the "label" field type "QCO Link"

4). Place this within the "calculation" field of the survey form; while using Survey123 connect. - concat('<a href="arcgis-survey123://?itemID=c08081e730be4c3ebf800676f91b366&field:QCP=',${QCPQ},'">Apri apparato</a>')

5). Within the "bind::esri:fieldType" choose the type "esriFieldTypeString"

6). Within the "bind::esri:fieldLength" choose a large value like 300.

7). Save your survey and have it refresh your form, then republish the form.

8). Within the Desktop version of Survey123, refresh your survey form.

9). Open the survey form and give it a try.

Things to remember is that you are constructing a string that is supposed to represent the custom URL, but will also act as a hyperlink. Also, you will need to make the note field large enough to contain the entire hyperlink URL string value. We are currently using hyperlink strings that reach upwards of a 1,000 characters.

Let me know if this works for you.

Mennoter_Bals
Occasional Contributor

Thanks James!

I've tried your suggestion by creating a new survey from the published feature service (AGOL) that I used for the Collector map. I enabled the Inbox and now find my newly added features from Collector in the Inbox.

After editing though I get a Send Error: "Code 1000, The given key was not present in the dictionary." I'm not sure if this refers to ObjectID or GlobalID. Any idea how to solve this?

JamesTedrick
Esri Esteemed Contributor

Hi Menno,

This is an bug on Survey123's part we see with some existing feature services; it will be resolved in the 2.3 version of Survey123 (which is getting released soon - we're going through the final stages of release preparation currently).

MatteoDe_Minicis
Deactivated User

Thanks Mike, very helpful suggestion !

I've tried it and it works fine.

I also experienced that in this way i can open different survey "childs" belonging to different forms (with different note fileds)  and establishing a relationship that can be used for monitoring the overall acivities.

I finally noted  that when i close a survey child i'm back to the survey parent and i can open another line of the same type, than means that i can have a relationship one-to-many extablished dinamically (for example if I have to design plant inspections containing hydrants and lifts and i don't know how many hydrants and  lifts are present on each plant to be inspected).

by Anonymous User
Not applicable

Matteo, This is starting to get tricky in terms of the schema that would be used to complete this task; or at least I think. If we think about this within a File Geodatabase schema and how it would be constructed.

Does this logic sound correct if you would have to set this up within ArcGIS Desktop?

1). It appears as though you have a main feature class that would mark the location of the QCP?

2). It appears as though the QCP could have two possible tables that would be considered related to the QCP feature class?

3). It appears as though you would like to have multiple entries into these two tables for each QCP?

4). It appears as though you would like photos for each of the two related forms/tables to be enabled?

So, the schema would be a feature class that contained two separately related tables with attachments enabled on the two related tables. I believe that Survey123 only supports one deep with respect to related tables and allow attachments?

Also we would like to use the GlobalID method when creating the relationship between the feature class and the related tables.

The problem is that currently linking or relating of two or three separate forms databases together is not supported. I think the team has plans to look into this within the next couple of quarters.

I think there is a way to achieve this at this point and it would be the use of repeats while utilizing "relevant questions" and the "pages" approach.THE issue is that the current version of the inbox does not support related tables.

1) The thought process would be to utilize the QCP form and create a group and a repeat from it's set of questions.

2) I would create a new survey form using the QCP form as a template.

3) Next you would open the second form named "Ispezione Apparato" and select all of the rows within the form,

4) Then start a new group under the QCP Group,named "Ispezione_Apparato_Group"

5) Then start a new repeat under the "Ispezione_Apparato_Group" and name it "Ispezione_Apparato_Repeat" for the label field call this "Ispezoine_Apparato" as this will name the related table and relationship that.

5) Then place your cursor within the first cell of column A under that group, right-click and paste "Values".

6) Then add a "end repeat" this establishes the repeat.

6) Then add a "end group" to establish this as a group.

This will now insert the "Ispezione Apparato" questions into the QCP form, but keep them together by ending the group. 7) You will want to repeat this for the "Ispezione Infrastruttura" form into the QCP form as well and name it "Ispezione_Infrastruttura_form". Please remember to substitute in the other forms name.

After you do this, then you will need to setup a "select_one" question within the QCP group that asks if the user is going to fill out either the "Ispezione Apparato" or "Ispezione Infrastruttura" forms as the answer. Let's call this question "Additional_Forms" that will be a "select_one" question that allows the user to choose either of the two forms as an answer.

You will then need to place within the "relevant" field for each group the following -

1) for the "Ispezione_Apparato_form" group; (${Additional_Forms}='Ispezione_Apparato')

2) for the "Ispezione Infrastruttura_form" group; (${Additional_Forms}='Ispezione Infrastruttura')

Within the settings tab of the excel spreadsheet you will need to place the word "pages" into the "style" column.

This will basically allow you to capture the data for both forms as related tables that are related to the QCP location. One thing to think about is if you want to capture the location of the two related forms, then you can add in a "geopoint" location and it will create a new location, but they will be setup as a new feature class that is related to the QCP point.

I hope this works for and if you have questions, then let me know.

Mike

TaraBoswell
Occasional Contributor

Sorry it took so long to get back to you. We did get this working. We have our Search Effort polygon feature service (which uses GlobalIDs) in Collector that the user creates when they get to their survey site. Once they create their work area polygon, we have the pop-up enabled and set to launch the following URL:

arcgis-survey123://?itemID=9461d3b60f2b4bd7a6b65e031b643296&field:CollectID={GlobalID}

The URL launches our Survey123 Form, which has a field called "CollectID" that is set to text (because the Global ID contains both numbers and letters). The URL above takes the Global ID of the polygon that was just created and passes it automatically to the CollectID field in Survey123.

Mennoter_Bals
Occasional Contributor

Thanks Tara, much appreciated! I actually came up with exactly the same method as you describe. Works fine for us!

SamPociask
Emerging Contributor

I have manually entered x, y coordinates in hopes of passing those to Survey123.  What is the syntax to grab the coordinates and center the geopoint on the set of values?

JamesTedrick
Esri Esteemed Contributor

Hi Sam,

To center the map, use center=y,x (latitude,longitude).  Note this needs to be in Decimal Degrees

SarahButler
Emerging Contributor

Hi James,

I want to open a map in Explorer from Survey123 and center the Explorer map on the coordinates that already exist in the Survey123 inbox.  Is there a way to do this with the geopoint/geometry field in my survey?  Or do I need to create decimal degree lat and long fields in my feature layer before create the survey and pull the coordinates from there?

SamPociask
Emerging Contributor

Hi James,

My x and y values reside in the attribute table from the underlying feature.   

So, just as I am passing the ID over, I'd like to pass the x and y values from my XCoord and YCoord fields.  

arcgis-survey123://?itemID=eb29ffbff5b94e169a6e7d290306f696&field:LAYDOWNID={AREAID}&center= my x/y fields?

Is this possible and if so, how do I write that out?

JamesTedrick
Esri Esteemed Contributor

Hi Sarah,

This is possible - the pulldata('@geopoint') function provides access to the geopoint question information- look at Geopoints—Survey123 for ArcGIS | ArcGIS for more details.  To open Explorer, you can create a URL that specifies the map and location to go to- take a look at GitHub - Esri/explorer-integration: Multi Language repository that contains documentation and sample...  for details.  As an example from that page:

arcgis-explorer://?itemID=2adf08a4a1a84834a773805a6e86f69e&center=43.656789,-70.278083
JamesTedrick
Esri Esteemed Contributor

Hi Sam,

You've got the pattern mostly correct- you would need to have the center value be {YCoord},{XCoord} (Survey123 expects Latitude,Longitude).  Also, the coordinates must be in decimal degrees.

douglascurl
Regular Contributor

How are parameters passed to the web version of the form: has the format https://survey123.arcgis.com/webclient/itemID - is this possible?

JamesTedrick
Esri Esteemed Contributor

Hi Douglas,

There is currently an issue blocking it, but once resolved the pattern for center & field parameters will be the same as the field app.

GlenColgate1
Regular Contributor

"Currently Survey123 doesn't support the workflow as you describe it.  As of yet, we don't have a parameter to denote 'load this existing feature for editing'." ...any chance this is raising to the top of the backlog?

We are toying with the idea of a single survey form that would be used multiple times (incrementally) throughout the workflow of a project. Each new visit would build upon the last, so the form would allow the user to review/update the content entered from the previous edits. We would like this "living document" to be linked to from several workforce assignments.

Thanks,

Glen

WillHughes2
Regular Contributor
WillHughes2
Regular Contributor

Another way to capture lat/long in Collector is to copy the lat/long "Location" coordinates when collecting a new feature. You can then paste the lat long values Ex. 35.67,128.21 to a text field. This works on iOS. 

KateRowe
Deactivated User

Hello,

I'm trying to open a Survey123 survey from Explorer via the pop-up on my Android tablet. Unfortunately the link arcgis-survey123://?itemID=db83da24c21a426aa695bb6822d985db just opens a new Chrome tab and gives me an error "This site can't be reached  arcgis-survey123's server DNS address could not be found ... ERR_NAME_NOT RESOLVED". I have the Survey123 app installed on this tablet and want the survey to open via the app (and eventually pass field attribute data).

Thank you.

JamesTedrick
Esri Esteemed Contributor

Hi Kate,

A few questions to diagnose the problem:

- What Android device do you have?  

- Do you know what version of Explorer you are using?

- Is Explorer connected to ArcGIS Online or ArcGIS Enterprise (Portal)?

KateRowe
Deactivated User

Hi James,
Sorry for the delay.

Android: Nexus 7 Version 6.0.1

Explorer: App Version 10.2.10 Build 1335

Explorer is connected to ArcGIS Online.

Thank you!

JustinConnerWR
Frequent Contributor

The blog notes using Geometry($feature).x and Geometry($feature).y which appears to be Avenue code, but it seems Avenue still isn't supported in Collector.  Has this changed?

SamvelArushanian
Emerging Contributor

hi,

nice what you do with survey123.
I've been able to configure link for the app.
Link has become:
arcgis-survey123://?itemID=XXXXXXXX&field:VlakID=1&center=9.999,9.999


but web version does not work. I can not set center

this does not work:

https://survey123.arcgis.com/share/XXXXXXX?field:vlakid=1&field:center=9.999,9.999

How can I set up my center for browser version?

JamesTedrick
Esri Esteemed Contributor

Hi Samvel, 

The parameters should be working for surveys published by Survey123 Connect; they currently do not work on surveys published by the web designer.

SamvelArushanian
Emerging Contributor

Hi James,

Survey is published with Survey123 Connect, but it is possible to use web form to fill in it with Surveylink: (Beta)(https://survey123.arcgis.com/surveys/X_service_here_X/collaborate).

 

TaraBoswell
Occasional Contributor

(edit: sorry, I tried to reply to a specific message but it put my comment on the last page...this is in reference to trying to populate a parentglobalid field in a feature service with the globalid of another layer that the survey is being launched from).

Right now I have a published feature service that contains survey site polygon layer that has relate set with rare species observation points. I published a survey123 form on top of the rare species points. The staff use Collector to create new survey sites and then when they see a rare species they launch the custom url for the rare species obs survey. I want the custom url to populate the 'parentglobalid' field in the rare species with the globalid of the survey site. Nothing comes across right now. I read comments about creating a note field to pass the globalid field to first and use the substr function in the calculation field to remove the curly brackets. I can't seem to get it to work though. I'd like to use this calculation:

substr(${incoming}, 1, string-length(${incoming}) - 1)

but do I put it on the note field and what does {incoming} get set to because whatever i've tried has triggered an error message.

Thanks!

MikeOnzay
Frequent Contributor

I have the same question.

I am not using a feature service with actual x,y fields.

Using a hosted feature class I tried this in a popup: arcgis-survey123://?itemID=<my id>:xField=Geometry($feature).x&field:yField=Geometry($feature).y It did not work. When I copied out the link before clicking it showed &field:xField=Geometry(%24feature).x&field:yField=Geometry(%24feature).y

I also created an arcade expression in the popup.

I used...&field:yField={expression/expr0}&field:xField={expression/expr1}

I copied out the link address to see what gets passed and it looks fine &field:yField=-8590245.98&field:xField=4733611.04

However, regardless if I use a note field or a text field the values are not being passed into Survey123. In this case, it seems that if I can see the values in the link then I should be able to pass them.

I've got passing the value from arcade expressions working now. The fields are set to esriFieldTypeDouble and works if the type is decimal or text.

JamesTedrick
Esri Esteemed Contributor

135019‌ - The link on the share page to access the survey's web version ( https://survey123.arcgis.com/share/<form_id)> does accept field parameters.

JamesTedrick
Esri Esteemed Contributor

Hi Tara - It might be helpful to see the survey.  Also, we see differences between the globalid received when Collector has an offline map vs. an online map- that's causing the bracket issue.

SamvelArushanian
Emerging Contributor
Hi James

You wrote:

The parameters should be working for surveys published by Survey123 Connect; they currently do not work on surveys published by the web designer.

My survey is made with Survey123 Connect, and "center" works on apps, but not on https://survey123.arcgis.com/share/<form_id>

and the question is: how to make it work? what command do i have to use?

MikeOnzay
Frequent Contributor

Is it possible to pass a date to a survey?

by Anonymous User
Not applicable

I have passed dates from one Survey123 form into another Survey123, but I have not attempted to pass a date from collector into Survey123. I'm curious...

MikeOnzay
Frequent Contributor

This is what I see in the web map popup.

Install Date: 10/14/2007 

It is stored as a date field in the underlying feature service.

copied from the URL

&field:MeterInstallDate={INSTALL_DATE}

copied from the link address

&field:MeterInstallDate=1192406400000

The survey field is a note and the name is MeterInstallDate. The field type is esriFieldTypeString and the length is 10. In this case it comes across blank because 1192406400000 is too large

I've also tried passing it to a text field (no explicit field or length set) in the survey. In this case 1192406400000 will get passed.

by Anonymous User
Not applicable

Can you pass the date into a “date field” that has the new function of assigning a “Null” for the “bind::esri:fieldType”. Then could you create a calculation that converts this "date" value into a "text" value that is in return stored within the field you need the text within?

MikeOnzay
Frequent Contributor

I can pass the date into a date field (testdate2) with the field type set to Null.

In different test fields I tried using string(${testdate2}) in the calculation but the answer was 1191384000000. I also tried using date(${testdate2}) and date-time(${testdate2}) but it just shows the date widget.

Although setting null on a date field solves the problem. I  am curious to know if it is possible to pass a date into a form and save it as text.

JamesTedrick
Esri Esteemed Contributor

Hi Alicia,

Just to confirm, you add the new point in Collector and after adding, re-click on it to display the pop-up header in the bottom; this can then be clicked on to display the full pop-up.

AliciaRitzenthaler
Occasional Contributor

I am trying to write a custom URL to pass Lat/Long from Collector to populate Lat and Long fields in a Survey123 form.  I'm trying to interpret the following note from the original post above:

If you want to pass lat/lon values from attributes in your feature, please be aware that the default formatting rules for the double data type cut-off decimal values to two. You will want to eliminate the formatting rule to pass all decimal values to Survey123.

If you want to pass lat/lon values from the geometry in a feature use Geometry($feature).x and Geometry($feature).y

Two questions:

1) Where/how to I eliminate the formatting rule to pass all decimal values to Survey 123? 

2) Can someone provide an example of how to write the actual url scheme segment with Geometry($feature).x and Geometry($feature).y? I have tried the following but get the unsuccessful attached result. Note that StreamReachPts is the name of the geodatabase feature class which prompts this survey.

&field:Latitude=Geometry($StreamReachPts).y&field:Longitude=Geometry($StreamReachPts).x

Alternative ways to pass Lat/Long from Collector to Survey123 are also welcome.

Thanks!

JamesTedrick
Esri Esteemed Contributor

Hi Alicia,

1) This is set in the Pop-up configuration of the layer in the web map.  Please see step 5 of Configure pop-ups—ArcGIS Online Help | ArcGIS ("Configure pop-ups" section)

2) The Geometry() function describes how to access the x & y values programmatically.  Currently, you will need X & Y fields in your table; in the future, new versions of the apps will support attribute expressions using the Arcade language.

Lake_Worth_BeachAdmin
Frequent Contributor

I am having issues with Android devices not executing survey123 when the link is clicked. the same link works on iOS devices, survey123 app is launched and the correct survey is started.... but not on Android (Galaxy s7)

by Anonymous User
Not applicable

Hi Joe,

From which other app are you trying to launch the custom URL from? If Collector, it should work in both iOS and Android, if from Explorer it is only supported in iOS, not Android. If you are using the link from Survey123 website it should work on both platforms.

Phil.

Lake_Worth_BeachAdmin
Frequent Contributor

I sent an email to myself with the link. I opened it on default email app and outlook app on iOS (both worked and opened the survey) and on Android I used outlook and the default email app. Android recognizes its a hyperlink (and clickable) but it does not trigger the survey123 app.

Lake_Worth_BeachAdmin
Frequent Contributor

I checked for all Android settings but could not figure it out. it can open other hyperlinks such as www.google.com

TimothyKing3
Regular Contributor

This functionality is awesome!  I am having a little problem though. To pass lat long attributes I am not sure how to "eliminate the formatting rule" so that I can pass all of the decimal values to Survey123?  I am getting the lat and long to show up in my url but then the point is not in the correct location.  I tried the center but the point is still off. All of the data is in WGS 84 Web Mercator. Really excited to begin using this and any help would be appreciated.

by Anonymous User
Not applicable

Hi Joe,

When you paste the URL into your email to send to yourself, does it have http or www at the front, please remove anything before the arcgis-survey123.

I have tested again on Samsing S8 Android 7.0 and working fine. Are there any other settings on your device, mobile device management (MDM) or IT policies?

Phil.

Lake_Worth_BeachAdmin
Frequent Contributor

Hi Phil,

thanks for getting back to me. There is no http: or www. in front of the url

arcgis-survey123://?itemID=(itemID here)

It works fine in my iOS device just not android. There must be a setting somewhere on the device blocking this. I am not familiar with Android enough to know where to search exactly.

www.google.com opens up fine in the email just not the survey123- app. link

by Anonymous User
Not applicable

Hi Joe,

Are you able to send me the entire actual link you are using, with any parameters, and are you able to share the feature service with me. Do other items ids work, or any custom url not working with Survey123 on that device? I would like to be able to replicate this, however not having much luck. If preferred you can send in private message. 

Phil.

Lake_Worth_BeachAdmin
Frequent Contributor

I will PM you the link, but I am getting this error

by Anonymous User
Not applicable

Hi Joe,

As mentioned in my email, below is a summary of the issue and workaround (for other users information):

Unfortunately, this appears to be a limitation or bug with the email application you are using on the Android device. Have you tried a different email application on the same device? The custom URL format you are using is correct, it is designed in a way to be used online and offline to launch the app, for some reason some Android mail applications block this. The other option is to launch the custom URL from a HTML file attached to the email, which we know will work.

 

Alternatively, have you considered using the Survey URL link to launch the survey, which can be found on the Survey123 website under the Collaborate settings page. This will only work when online (internet connection) as requires opening the Survey123 website first then launching the app, however it is all automated so no need to click anything, it just takes a few seconds longer. I tested with your survey and emailed the link to myself on Android with Gmail and default Samsung mail app, and works perfectly.

 

Your link would be as follows (replace XXX with ItemID): https://survey123.arcgis.com/share/XXXXXXXXXXXXXXXXXXXXXXX?open=native

 

Here is where you can find and set the survey link option on the Survey123 website:

Regards,

Phil.

BrentKinal1
Frequent Contributor

I am using a custom URL to open Collector from Survey123 and pass a GUID from S123 to Collector, I was wondering if there is way to programmatically close and upload the Survey123 form when the link to Collector is clicked?

Thanks,

Brent