Survey123 Tricks of the Trade: Editing records in a web form

28597
136
05-23-2019 05:34 PM
IsmaelChivite
Esri Frequent Contributor
16 136 28.6K

[Updated February 29, 2020]

IMPORTANT: Check the https://community.esri.com/groups/survey123/blog/2020/02/19/upcoming-changes-to-survey123-web-forms-... blog post for upcoming changes affecting content described in this article.

Today we will explore how you can edit existing records using the Survey123 web app, also known as a web form. The idea is quite simple, we will populate the contents of a Survey123 web form using an existing record from a feature layer and let users update (edit) that information. When working this way, the submit button in the survey will update an existing record, as opposed to creating a new record for a new survey response.

This technique for editing data in a web form be quite handy. You can use it for example to let people review and modify existing submitted data, or to simply let them finish an uncompleted form. You can also incorporate web forms into QA/QC and data validation workflows.

Before we start, be aware of the following:

  1. The editing of records in web forms is only available in the Survey123 web app after May 23, 2019 (version 3.4 and newer). I will describe later in this blog how you can make your surveys run in this latest version, even if you published it in the past in an earlier version.
  2. Version 3.9, introduced important changes to the syntax used to edit features in a web form. Refer to the https://community.esri.com/groups/survey123/blog/2020/02/19/upcoming-changes-to-survey123-web-forms-... for details.

The Basics

Editing of existing data in a web form is possible through the use of web form URL parameters. If you are not familiar with web form URL parameters in general, I strongly suggest you read the https://community.esri.com/groups/survey123/blog/2019/02/06/survey123-tricks-of-the-trade-web-form-u... first.

Here is an example:

https://survey123.arcgis.com/share/1cb28b212b5542acbbdbaa35feba0765?mode=edit&globalId=fb364524-e523...

Note the two URL parameters:

  • globalId=fb364524-e523-4f5d-9174-3def4bd21086, this parameter loads the record in your feature layer with the record  with globalId fb364524-e523-4f5d-9174-3def4bd21086 into your form. Of course, you can replace the globalId with the specific value of the feature you want to load.
  • mode=edit, puts the web form in edit mode. This essentially ensures that when the user hits the submit button, the current record is updated. If the mode is not set to edit, the form will create a new record when submitted, even if the form was initialized with data from a particular record.

URL parameters are case sensitive. For example: globalId is not the same as GlobalID or globalID. If you see that your form is not loading the record you want, double check the spelling of the parameter, and also ensure the globalId you are trying to load exists.

As described above, the editing mode in web forms was incorporated in version 3.4. If you want to edit records using a survey that was published in the past, you can bring things up to speed in two different ways:

  • Upgrade your survey by simply re-publishing it. If you originally published your survey using Survey123 Web Designer, then use Designer to publish it again. You do not need to make any changes other than simply clicking the Publish button. The same goes with Survey123 Connect for ArcGIS: If you originally published your survey with Connect, go back to Connect and hit publish.
  • Upgrade your survey at run-time: You can alternatively add the version=latest URL parameter to force the survey to be loaded using the latest available Survey123 web app. Something like this:

https://survey123.arcgis.com/share/1cb28b212b5542acbbdbaa35feba0765?mode=edit&globalId=fb364524-e523...

My recommendation is that whenever possible you upgrade your surveys by re-publishing them. It will improve the initial loading time of the survey in the web browser, and it will guarantee that the behavior of your web form remains unchanged even if the Survey123 release changes.

From a practical perspective, the technique described above is useless unless you somehow present a ready-to-use link (URL) to the end user; A link that already includes the appropriate globalId to edit. Do not expect end users to modify that globalId manually in the web browser URL address!  I will next describe three scenarios to illustrate how you could apply this technique.


Launching an edit web form from a feature popup

Our first scenario allows users to navigate a map, and launch an edit web form from the popup of an existing record. The key is to customize the feature layer popup so it dynamically generates the correct URL to launch the survey. Once the popup is configured, you can use the web map within the ArcGIS Map Viewer, custom Web AppBuilder apps, Explorer for ArcGIS and any app that supports web maps.

Here is a brief step by step guide to configure your popups:

  1. Using the ArcGIS map viewer, add your survey feature layer (or hosted feature layer view) into a web map.
  2. Open the configure popup dialog for your survey feature layer.
  3. In the popup contents section, select a custom attribute display.
  4. Add the URL of your web form into the attribute display. Then add the mode and globalId parameters.
  5. Dynamically populate the globalId parameter using the globalId field from your feature layer.
  6. Use the full web form URL with its parameters to create a link.
  7. Save the popup and test it out.

Embedding an edit web form within Operations Dashboard for ArcGIS

The idea with this one is to add an embedded content element within the dashboard, and configure it to display your web form.  The URL of the web form will include the mode parameter set to edit and the globalId will be dynamically populated.  Using a filter action triggered by other element within the dashboard, such as a list, the embedded content element will refresh your web form with the relevant record to be edited.

At a high level, the steps are as follows:

  1. Set a refresh rate on a web map displaying your survey feature layer.
  2. Add your web map to a new dashboard and configure a list element to display survey records.
  3. Add an embedded content element. In the Data options, set the Type to Features and add the URL of your web form with the mode=edit  and globalId parameters. Make sure the globalId parameter is set to pull a value from the globalId column in the fields collection.
  4. Next configure a filter action on the list element and target your embedded content element.
  5. Click on a record in the list, and your web form in the embedded content element will display your record in edit mode.

For more details about this, check https://community.esri.com/groups/survey123/blog/2020/04/27/survey123-tricks-of-the-trade-embedding-... 

Including an edit web form link in an e-mail.

In this scenario, we will use a web hook to automatically send an e-mail to the user submitting the survey. This email will contain a link for the user to complete or make modifications at any time.  To do this you must be familiar with web hooks in general or with either Microsoft Flow or Integromat.   Like in the examples above, the trick is to be able to dynamically populate the globalId of the record you want to edit. Luckily enough, the payload of a Survey123 web hook includes information about the user submitting the data (if logged-in) as well as responses to questions in the survey. So as long as the user is logged-in or a specific question in the survey captures the contact e-mail, you can make this work.

Here are the high level steps:

  1. Create a new survey. If you plan to share your survey publicly, include an e-mail question and make it required. If  you plan to keep your survey secured, you will be able to get the e-mail from the logged in user's profile.
  2. Use Microsoft Flow or Integromat to automate e-mail notifications when your survey is submitted.  The globalId of the record submitted is included in the payload of the web hook. Simply add the globalId to the URL of your edit web form when you add the link in the body of your e-mail.

Here is some visual aid in case you are using Integromat.

Survey123 Integromat

If you are using Integromat or Zapier, the pattern is pretty much the same: use the webhook payload to retrieve the globalId of the submitted record and use if for your edit web form url.

Tags (2)
136 Comments
JohnBrosowsky1
New Contributor

… update: I did find that changing version=latest to version=3.5 works.  3.6 and higher does not work.

NourSalam
New Contributor

Hi James,

Is survey123 web form editing for repeats a feature that's being voted on or that is planned for the future?
Thanks!

ChaimSchwartz4
Occasional Contributor

Also tried it with Enterprise and couldn't get it working, using the following URL:

survey123.arcgis.com/share/XXXXXXXXXXXXXX?mode=edit&portalUrl=XXXXXXXXXXXXXX&objectId={objectid}‍‍

The objectid wouldn't be passed. Is this supported James Tedrick‌?

ChaimSchwartz4
Occasional Contributor

Actually I just got it working, by capitalizing the OBJECTID (objectId={OBJECTID}).

DaveRoman
New Contributor

I have an ArcGIS Online webmap of Manhole features. We are using Collector to identify the feature, then launch a Survey123 URL to collect inspection data.

Is there a way the popup can be configured where a user can click on an existing Manhole feature and view results of the survey?

From the example above, I am unsure how to relate the survey's objectid (or globalid) with a unique identifier within the Manhole feature class.  

i.e. https://survey123.arcgis.com/share/1cb28b212b5542acbbdbaa35feba0765?mode=edit&objectId= 

TimothyKing3
Occasional Contributor

Does this process need a feature service created using Survey123 Connect or the Survey123 WebDesigner?  The reason I ask is I first tried creating a 123 form using an existing feature service through Connect.  I used the web link, mode=edit and the objectID= {OBJECTID} but I was unable to see the points in the webform and none of the attributes showed up either.  So then I created a new 123 form and created the feature service and then populated that with an existing point file.  I was now able to see the points in the webform in 123 but was still unable to get the attributes to come into the webform in Ops Dashboard.  I thought it may have something to do with the AddUpdates in URL Parameters.  Any thoughts?

Thanks


LTK

AnninaRupe
Occasional Contributor

Ismael Chivite‌,

I'd like to be able to open a survey and have it autopopulate some fields from ArcMap, similar to what you can do from a web map (my users have access to Desktop but not ArcOnline without having an extra cost). More detailed: I'd like my users to Identify a point in ArcMap, click on the URL that I've included in the attribute table, and fill out the survey, minus the questions that are autopopulated through ArcMap.

I can get it to work partially; if I set the question to a static value, it works (e.g. field:Name=Joe). But, if I pass it the field, it doesn't (e.g. field:Name={Name}). Is this something I should be able to do in ArcMap?

I've started to work around it, but it means that I'd have to manually edit each and every record's value to work. I'd like to just be able to copy/paste the generic URL. I've also tried to write a field calculator to pull the data and write it out, too, but I'm running into roadblocks there as well. Any help you can give would be great.

Let me know if you need any more information.

Thanks,

Annina

MichaelWalsh
New Contributor

Has anyone experienced issues with ?mode=edit&objectId=1 working fine in some browsers but not in others?  Currently working fine in Chrome, my home version of Firefox but not work version and will not open in safari on an iPhone.

I receive the dreaded "Editing is not possible because the record specific by the object parameter cannot be found"

I cut and paste exactly the same URL into each browser.  For some it works for others it doesn't.  Even embedding the survey in a dashboard causes the same issue. Is it likely a browser version issue?  If so any idea how I might be able to get it functioning on an iPhone?

Any thoughts?

JamesTedrick
Esri Esteemed Contributor

Hi Dave,

There are a couple of ways you could considering doing this:

- You could use the Arcade FeatureSets to get the information from the related table and display it in the form.  See What’s new with Arcade: Taking a stroll through FeatureSets (Part 1)  on getting started with this.

- You could create a joined hosted feature layer view that contains the most recent inspection information.  See Visualizing related data with Join Features in ArcGIS Online  on getting started with this.

JamesTedrick
Esri Esteemed Contributor

Hi Timothy,

Without seeing the link generated, I can't tell what may be at issue.  that being said:

- note the capitalization of objectId (not objectID)

- in your description, there is a space between 'objectId=' and {OBJECTID}.  There cannot be a space in the URL.

JamesTedrick
Esri Esteemed Contributor

Hi Annina,

First I'm a bit surprised - every user of ArcGIS Desktop has a named user that can be used for an ArcGIS Online or ArcGIS Enterprise organization, so if your users have access to Desktop, they should have access to your organization.

Yes, so long as the URL is passing information correctly you should be able to create a hyperlink.  are you doing so through the hyperlink feature layer property?  Using Hyperlinks—Help | Documentation 

JamesTedrick
Esri Esteemed Contributor

Hi Michael,

We have not seen differences between versions of browsers; the fact that you have a different experience between 2 Firefox installations (presumably on the same version) indicates that this isn't necessarily a browser issue.

AnninaRupe
Occasional Contributor

Thanks for the response, James. I was able to figure out the URL late last week. I used the field calculator with a python string to calculate unique URLs. It's not pretty, but it works!

As for the Desktop/Online bit: yes, this is normally the case. However, I work for a State agency and the way the State recoups its costs for Esri products is by charging each agency based on what their employees use. For a user to have access to both Desktop and Online, the agency has to pay the State for both. It's not cost-effective for us to have a majority of users to have both.

DaveRoman
New Contributor

Hi James, I appreciate the suggestions. What we are looking for is much simpler than this - just a way to show the  Survey123 results (form and all) when a user clicks on an existing feature. This would be a nice simple way to allow folks to view the actual inspection and results for a particular feature rather than scrolling through results in tabular form.   

JamesTedrick
Esri Esteemed Contributor

Hi Dave,

Just to confirm, the form only includes the inspection data fields?  If so, you could use the FeatureSets Arcade functionality to query the related records and then create links that open each inspection form in the Survey123 web form in view-only mode. The following should help:

What’s New in Arcade 1.8 (Talks about FeatureSets from relationships)

What’s new with Arcade: Taking a stroll through FeatureSets (Part 1) (Introduces FeatureSets)

MaazaMekuria
Occasional Contributor

Hello, Timothy :

Linking Op Dashboard and the form must share the same Object Id, which means they share the same feature class.  You can generate a from from feature class by setting the design to be based on a feature service.  Then use the object id to link the form and dashboard while embedding the form into the dashboad.  Feature Class based form

CarlosMota
New Contributor

Hi James Tedrick

It is already possible to edit repeats in web form??

thanks

OussamaMerhi
New Contributor II
MaazaMekuria
Occasional Contributor

hello, Oussama, I think you just need to change the "objectid" to "objectId".  it is case sensitive.

OussamaMerhi
New Contributor II

Thanks it is working now.

KarinaLivingston
New Contributor III

I have a survey embedded in my hub site and was hoping there was a way to automate the Survey123 page closing and taking my user back to the hub site once they have submitted it? 

DataOfficer
Occasional Contributor III

I would like to know the answer to this too. Or if there is a workaround for editing the data in repeats in ArcGIS Online?

DanMoses1
New Contributor II

Is it possible to use this method publicly? It works wonderfully for logged in members of the org but errors if there is no log in. All setting for all portions are set to public etc. Is there a way to give viewers editing privileges?

Thanks 

JamesTedrick
Esri Esteemed Contributor

Hi Dan,

I would be wary of allowing editing by anonymous (public) users.  Editing requires a user to query the table; by enabling editing for anonymous, you will make the entire results of the survey queryable (readable) to the public. 

DanMoses1
New Contributor II

Hi James

Understood.  In this instance I am working with a set of info that I am comfortable with that risk. Is there a way to make the data available anonymously or can you recommend a strategy where participants can easily modify group data?

Thanks

JamesTedrick
Esri Esteemed Contributor

Hi Karina,

At this time there isn't a way to configure the web form to autoload another web page.  If the form is embedded in the hub site, isn't the user still on the Hub page?

KarinaLivingston
New Contributor III

Hi James,

Thank you for the clarification and for taking the time to respond to my question. You are right, I miss spoke here. We at first tried embedding the survey but we didn't like that we couldn't expand the survey completely (even after messing with the height size) but either way with two surveys on the page it would have made it too long. So I switched to the Survey Setting "Feature" instead of "Embed". We like this option but it launches the survey in a new window. We were wondering if there was a way to close that new window once the survey was finished and submitted so the user could be automatically taken back to the page. However, the workaround isn't terrible, the user will just have to exit out of that window/ tab. 

Thanks,

Karina 

AleksandraZietara
New Contributor III

Hello, I have found out the information that: To edit in the web app using URL parameters, a user must be a submitter or the survey owner and be able to add and update records.

My survey is shared public but the rule still applies. Is there any way to allow another user form my organization (not the submitter and not the survey owner), to have a possibility to edit existing survey data in web app by using mode=edit&globalId=? ?

Thanks.

JenniferMcKee__GISP
New Contributor II

I am trying to embed an editable survey in an operations dashboard and am using the following private url https://survey123.arcgis.com/share/90c975abb7e24e7ea0d24d74e5b30204?mode=edit&globalId={globalid} with a list that is acting on the embedded content. I have set the survey to allow add & update from the survey settings. But when I click on my list chrome pop opens the following window. 

If you click on "Leave" it refreshes the survey window but it does not populate with the selected survey data from the list. I don't understand why this doesn't work and tries to open a new window.

Any help would be greatly appreciated!

JenniferMcKee__GISP
New Contributor II

So it appears my survey was updating but it doesn't populate the 1st 3 fields for the point of contacts information. This information is conditional calculated. If they are a frequent submitter they have an option to select their name from a list and it fills in the name, email and phone number. If they choose no for frequent submitter they have to fill in their contact info.

Jean-SebastienLauzon
New Contributor II

Hi James,

Has this function (editing record via URL scheme) been implemented to the field app yet?

Thanks

WhitneyWeber
Occasional Contributor

This is swell, but I'm wondering if it does not work with external_choices and pulldata capabilities? My survey uses both and although the survey record opens (so I have the syntax correct), I then get an error that 'External instance "Genus" is empty', so I'm guessing this isn't feasible with itemsets.csv and other .csv files in the media folder.  I added, published, and shared the tables within the Survey folder but that did not resolve the problem. Is there a way to pass the URLs of the required tables via the web form URL parameters so this can work with external_choice and pulldata?

JenniferMcKee__GISP
New Contributor II

I have been successful in using an external choices list and pull data from another csv file in my media folder.

WhitneyWeber
Occasional Contributor

Jennifer, you got this 'Editing records in a web form' to work with external_choices and pulldata or you got external_choices and pulldata to work in a Survey123? They work in my survey, that's not the problem. But when I implement this web form to edit the records, I get an error about it not being able to access data from one of the csv files.

If you did get them both to work with this web form edit option, please tell me how!

JenniferMcKee__GISP
New Contributor II

Sorry, about that I was being slow. I ended up publishing a new survey based on an existing feature service to edit my survey that contains an external choice list and pulldata from a csv due to having hidden and calculated fields not exposed in the original survey to the user that I wanted to expose for editing.

WhitneyWeber
Occasional Contributor

It is still not clear from your response whether you got this working and if so, how. You had the original survey containing an external choice list and pulldata. You then created a new survey based on the feature service of that original survey? And then you were able to use this web form to edit the data in the original survey by passing the URL of the new survey? If so, please indicate how, as I would really appreciate the help getting this working! When you created the new survey, did you put data in the choices tab? I need details!

I created a new survey based on the original survey feature service but it does not work without the external choices, which is the original problem. I too have hidden fields that I would like to expose for editing, so if you got this to work, please share your exact solution!

ChaimSchwartz4
Occasional Contributor

Hello Whitney, it is hard to know if what I have is the exact scenario you have, but I do have a working example of a (1) survey123 webform (2) that includes an external choices option using the itemsets.csv file and (3) a different field performing a pulldata() function on that same itemsets.csv file. I am able to edit it in a web form in editing mode, so this should work. This is not however a survey123 published on an existing feature service, rather it is a published survey writing to its own hosted feature service, not sure if that makes a difference.  Currently I have it working on the beta survey123, but it did work earlier on the current version as well.

WhitneyWeber
Occasional Contributor

Chaim, thank you for your reply! My original survey was created in Connect via a spreadsheet, not from a feature service. I just tried that because Jennifer suggested she got it working that way and is not ideal for my purposes as you then have to reconfigure everything. Regardless,...

So my pulldata is referring to two separate csvs (not the itemsets.csv), which makes me wonder if I can simplify things by putting it all in the external_choices tab (which obviously populates the itemsets.csv file). Are you then referencing the itemsets.csv in your pulldata() function? And that works successfully as a web form in editing mode? If so, that would be fantastic! I appreciate your help!

WhitneyWeber
Occasional Contributor

Please see my previous reply, too, which I couldn't seem to edit to add this information. So, I put all of the data into the external_choices tab, and hence it's in the itemsets.csv. So, pulldata are only referencing itemsets now. The survey tests and publishes successfully but when looking at it via a webform, I get errors regarding all of my select_one_external types (i.e. "External instance "Genus" is empty.") although the data is in the itemsets.csv, as can be seen below.

ChaimSchwartz4
Occasional Contributor

Hello Whitney, 

I can confirm that I have it working as you describe - pulling data from the same itemsets.csv that is the source for the external selects, and editing in a webform, and it does simplify the process a bit having just one file to maintain. I am not sure why it is not working for your - I would make sure that you are working off the most recent survey123 connect, and start off with a simple test file from scratch, then slowly add some of your other features/calculations etc to see where the problem is. Also make sure that your external selects are participating in a cascading select. 

WhitneyWeber
Occasional Contributor

Chaim,

I appreciate that you're still replying!

I had previously updated to the most recent version of Connect, so am running 3.9.120.

As you suggested, I stripped back the survey to the basics, where I receive the first error (still) when opening the web form: External instance "Genus" is empty. Yes, I am using a cascade constraint and a choice filter with the select_one_external Genus.

How does the web form even know of the itemsets.csv given that it is not in the survey folder nor a table within the hosted feature layer? Am I missing an integral step to expose the itemsets.csv to the web form?

Whitney

ChaimSchwartz4
Occasional Contributor

Hello Whitney, 

The itemsets.csv file should be in the "media" folder, and should be automatically created for you when you create external selects. If you can share your stripped Excel sheet I will try to take a look into it.

Chaim

WhitneyWeber
Occasional Contributor

Chaim,

Thanks for your response. After a lot of trial and error, I determined the error was caused by a space in a column name which was introduced when I added the data from my external .csvs into the external_choices tab. The space in the column name was not problematic in the other csv (or in the app or Collector) but made the web form hiccup when included in external_choices and hence the itemsets.csv file. Removing the space resolved the problem.

Thank you for your help!

Whitney

ChaimSchwartz4
Occasional Contributor

I'm glad to hear that you got it to work. Embarking on brave routes like this always involves hiccups...

PaulSolsrud
New Contributor II

Hi Dan, did you ever find an answer to this?

DelaereMickael
Occasional Contributor

Hello everybody,

i both read the article about url scheme of the webapp and this article.

i try to combine the edit mode and the field:<namefield>=<newvalue> parameter.

but it does not work.

is it possible to combine this parameters in a same url?

https://survey123.arcgis.com/share/9fd130fc234e4dafa47337539c3f9fc2?mode=edit&globalId=3a540195-0650...

thanks for help!

PaulSolsrud
New Contributor II

Good question, the one thing I know is that the feature needs to be publicly shared, so make sure you rule that out first.

MaazaMekuria
Occasional Contributor
WhitneyWeber
Occasional Contributor

That's ironic because I've been trying to pass a field value, in edit mode, to display a hidden section in the Dashboard, but it won't work. I was told by Esri that you can't pass field values in edit mode.

Neither of the following work to actually pass the value:

https://survey123.arcgis.com/share/8357afa6eb3e4dc4bd1d5464c649e481?mode=edit&globalId={globalid}&hi... 

https://survey123.arcgis.com/share/8357afa6eb3e4dc4bd1d5464c649e481?mode=edit&globalId={globalid}&hi...

If somebody could get this to work, I would be thrilled! Please let me know!

MaazaMekuria
Occasional Contributor

Hello, Whitney,

I am doing nothing other than following the syntax for the query (whether edit or not) and here is what I did to your second edit url  (except that the gelobalid in the query was not avaialable and was set as a variable so I could not get to the particular record  and a generic data was returned)

https://survey123.arcgis.com/share/8357afa6eb3e4dc4bd1d5464c649e481?mode=edit&version=latest&status=...

the response is here 

If this is not what you would like to see then perhaps I did not grasp your problem.

One more thing here, I think the query parameters are changing perhaps as we speak and the latest version (3.9+ ) maybe going in a the direction of adding a "field:" identifier to each field etc.  But it seems to now work with just the name and value pair.