trying to open existing record in survey123 using a link in field maps popup, no luck yet

1979
9
Jump to solution
02-09-2022 05:42 AM
BertKraan1
Occasional Contributor III

I have a simple featurelayer with a 1:m related table (treesafety & inspections) 

In Field Maps I can tap the feature which opens the popup. Popup is configured to display an expression.

the expression:

BertKraan1_0-1644402563628.png

The link in the popup:

BertKraan1_1-1644402649018.jpeg

Tapping the link starts survey123 on my iPhone and opens the correct survey but the record/feature does not load, it's just an empty survey (which I can fill in and that will create a new feature but that's not what I'm after) The survey has a repeat section but is otherwise not complex:

BertKraan1_2-1644402950131.png

What should I do in order to load the feature I tapped on in Field Maps? Is it because I (might) have several related records? is  this BUG-000137679 ?

 

Any help on this will be greatly appreciated, thanks for you time.

 

Bert

 

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

The URL example I gave is to create a new record and pass data into fields in the form.

"arcgis-survey123://?" ok, I get that, pass it in as a string

"itemID=0333333333420ad9940a988" that will be the survey we want to open, I got that working

"&field:PointID={PointID}" this will be the feature you want to load in the survey? - no this is passing the value of the field PointID in field maps to the field PointID in Field maps - this is my key so that the point and the form are related.

"&field:EvaluationID={expression/expr0}" but what does this do??  - this sends the value from this Arcade expression into the field EvaluationID in the form

I always make each inspection a new record that is related to the main point by passing in a key.  That way each inspection has a location, editor tracking, etc.  Having each inspector edit the same record is not a good workflow in my opinion. Seems like you are doing this but inside a repeat in the form.  Not sure why.  How I relate them is here  https://community.esri.com/thread/221263-mapping-with-survey123-within-a-polygon-or-admin-unit 

If you want to edit a record you need to tell it the globalid of the record to edit.  You are missing the action=edit part.

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

See here https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-editing-records-in... 

Hope that helps

View solution in original post

9 Replies
DougBrowning
MVP Esteemed Contributor

I think you have the format wrong and there is no need to encode in most cases.    You did not post what the actual URL is so it is hard to tell.

But it should look like this.  This is sending one regular field and one Arcade expression.  I always use mine as set links and generate the fields to send and not the whole URL.

arcgis-survey123://?itemID=0333333333420ad9940a988&field:PointID={PointID}&field:EvaluationID={expression/expr0}

 

hope that helps

0 Kudos
JasonCyphers
Occasional Contributor III

So, if I had an inspection table that is populated via Survey123, what would my URL and/or arcade expression need to be to open a Survey123 form, populated with the information from a specific inspection record, so that I could modify it?

0 Kudos
DougBrowning
MVP Esteemed Contributor
0 Kudos
JasonCyphers
Occasional Contributor III

Thanks.  I've checked them out, with no success.

I'm able to get an existing record to open in the web version of Survey123, but no the mobile app.

0 Kudos
BertKraan1
Occasional Contributor III

Hi Doug,

Thanks for your reply. I'm confused.

Do you send an Arcade expression to Survey123, in other words is the expression executed by Survey123?

This (English) is not my first language (and Arcade isn't either :-}) so bear with me please; if I break down your url correctly I get:

"arcgis-survey123://?" ok, I get that, pass it in as a string

"itemID=0333333333420ad9940a988" that will be the survey we want to open, I got that working

"&field:PointID={PointID}" this will be the feature you want to load in the survey?

"&field:EvaluationID={expression/expr0}" but what does this do??

 

At the moment I'm able to open the correct survey in the survey123 app from a link in a popup in field maps but I didn't yet succeed in loading the feature in that survey.

 

This really opens new ways for my collegues to work, fascinating. I hope you have time to comment.

 

Regards,

Bert

 

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

The URL example I gave is to create a new record and pass data into fields in the form.

"arcgis-survey123://?" ok, I get that, pass it in as a string

"itemID=0333333333420ad9940a988" that will be the survey we want to open, I got that working

"&field:PointID={PointID}" this will be the feature you want to load in the survey? - no this is passing the value of the field PointID in field maps to the field PointID in Field maps - this is my key so that the point and the form are related.

"&field:EvaluationID={expression/expr0}" but what does this do??  - this sends the value from this Arcade expression into the field EvaluationID in the form

I always make each inspection a new record that is related to the main point by passing in a key.  That way each inspection has a location, editor tracking, etc.  Having each inspector edit the same record is not a good workflow in my opinion. Seems like you are doing this but inside a repeat in the form.  Not sure why.  How I relate them is here  https://community.esri.com/thread/221263-mapping-with-survey123-within-a-polygon-or-admin-unit 

If you want to edit a record you need to tell it the globalid of the record to edit.  You are missing the action=edit part.

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

See here https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-editing-records-in... 

Hope that helps

BertKraan1
Occasional Contributor III

Thanks Doug, I really appreciate your reply.

I'm inching my way forward, learning every day. I followed your workflow from the  link you mentioned above (...mapping with survey123 within a polygon or admin unit...) and at the moment I can open a new survey with reference to an existing record from within fieldmaps. the survey gets stored and related to the feature class item and all seems fine.

Great! Several things I still need to work out but this hurdle is taken.

 

Regards,

Bert

BertKraan1
Occasional Contributor III

So, to whomever this might be of help:

this is my arcade expression for a sorted list of previous inspections so you can see the history:

 

var RelDataSorted = Orderby(FeatureSetByRelationshipName($feature,"geïnspecteerd op/door"),'inspectiedatum DESC')
var popupString = ''

for (var f in RelDataSorted){
    popupString += text(f.categorie) + " " + text(f.inspectiedatum, 'D-M-Y') + TextFormatting.NewLine
}

return popupString

 

 

this is my arcade expression to open a survey, create a new related entry and return to the field map afterwards:

 

var urlSource = 'arcgis-survey123://?'
var vtaTree = $feature.GlobalID
// itemID here means the field maps map to return to
var gotoFM = 'https://fieldmaps.arcgis.app/?referenceContext=open&itemID=1bea04dacb0d4732b367079c039dcbbd'

// itemID here means the survey to open in S123
var params = {
    'field:foreign_key':vtaTree,
    itemID:'15fe03654cb4466fbb760a62dcae8af5',
    'callback':gotoFM
};


return urlSource + UrlEncode(params);

 

 

and this is what it looks like on an iphone:

BertKraan1_0-1646120653305.jpeg

 

Now, if I only could find that blogpost again where the author showed how to replace the url with a button my happiness would be complete, but I'm quite happy as it is.

I'm sure the expressions can be better but hey, if it works it works...

 

regards,

Bert

 

Caution: While this works you will encounter difficulties when you try to upload existing data: the GlobalID in your 'parentFC' will be different in your target (unless you have a enterprise gdb and the environment set up correctly) 

0 Kudos
DougBrowning
MVP Esteemed Contributor

In FeatureSetByRelationshipName if you set just the fields you want and set return geometry to false it will be a faster lookup.

I forget how to make the button.  I use a set URL and not Arcade.  You may be able to make a link and give it {expression/expression0} thing?

Sorry not sure

0 Kudos