Select to view content in your preferred language

FieldMaps Form Calculation not applying edits after linked Survey123 is submitted

853
0
04-18-2022 02:05 PM
Caitlin_Todd_LCOR
Regular Contributor

Hello all, 

I have a complicated set up to my question, so please bear with me. 

I have a new workflow design where:

  • A site needs many inspections
    • 1:M (points to related table).
  • Field crews need to visually see which sites have gone the longest without being inspected.
    • Going to be using a hosted feature layer view off of a "Last Inspected Date" field. (which gets auto-populated further down.)
  • Field crews also need to be able to add new inspection records to the sites without having the ability to add/delete/move site points.
    • I initially wanted to meet all the requirements in FieldMaps form configurations and the new Map Viewer in AGOL, but that might not be possible in the latest version of FieldMaps. See my related question  "Restrict Editing to related records.. etc".
  • Field crews also need to have minimal data entry requirements.
    • I plan on using Arcade for most of that.

As a work-around to my related question, I did the following:

I created a Survey123 survey off of my inspection table and put it's URL link into my site layer's pop-up. The survey is quite simple; it pulls in the GlobalID from the site to retain the 1:M relationship and returns to FieldMaps upon submitting survey all in the URL parameters. 

Survey123 URL link:

 

arcgis-survey123://?itemID=SOMEITEMID&field:REL_GlobalID={GlobalID}&callback=https%3A%2F%2Ffieldmaps.arcgis.app%2F%3FitemID%SOMEITEMID%26referenceContext%3Dopen

 

Then on the FieldMaps/new Map Viewer side, I created a Form Calculation to look through all the historic inspection records where site globalid equals the inspection record's guid, find the latest one, and use that value to auto-populate a "Last Inspected date" field in the site layer. The hosted feature layer view will then use that value to differentiate between those that haven't been inspected in many years and those that have been inspected within a year of today's date. 

Form calculation on the "Last Inspected Date" field is:

 

var child=FeatureSetByName($map,"InspectionRecords",['INV_DATE','REL_GlobalID'],false);
var parentguid = $feature.GlobalID;
var sql = OrderBy(Filter(child,'REL_GlobalID=@parentguid'),'INV_DATE DESC');
var tbl = First(sql)
return tbl.INV_DATE

 

 

THE TROUBLESOME PART. After submitting the inspection survey, the "Last Inspected Date" calculation runs, BUT doesn't apply its edit to the site point. So the user doesn't see the site pop-up reflecting his submitted survey until he edits the site point. The new "last inspected date" can be seen then.

So the user would have to:

  1. click site and then click link to survey
  2. fill out and submit survey
  3. click on and edit the site point
  4. submit edits without actually making any edits

then he can see the survey's last inspected date come through into the site's pop-up. 

My question is, is this expected behavior? Is there a better way to set-up this workflow so all requirements can be met?

Thank you for reading my tiny novel,

Caitlin

0 Kudos
0 Replies