Hi, I have a property polygon layer that I want my user to be able to select on the map in field maps, copy that read only polygon to a new editable property survey layer and fill out some attributes and an inspection record (in a related table). The user can do that using the copy button but I was trying to make it a bit nicer/slicker. Is it possible to add a link in the property polygon popup that will automatically copy the polygon into my property survey layer and bring up the form for them to fill in the details and related inspection details? Thanks
Hi @GISNCC ,
You can achieve this with some pretty straightforward arcade:
var referenceContext = 'addFeature'
var itemID = 'abcdefghijk123456567' //your webmap url
var featureSourceURL = 'https://example.arcgis.com/org/arcgis/rest/services/servicename/FeatureServer/index' //url of your target feature
var new_geometry = Geometry($feature)//get the geometry of the selected feature
//Here the read-only feature has a SiteID and Notes field, they're going to be written to SiteName and SiteNotes fields in the target layer.
var new_attributes = {
"SiteName": $feature.SiteID,
"SiteNotes": $feature.Notes
}
//put everyting together into an app link. Notice the geometry is getting encoded, and the attribute dictionary is converted to json using the Text() funciton, and then it is also encoded.
var link = 'https://fieldmaps.arcgis.app/?referenceContext=' + referenceContext + '&itemID=' + itemID + '&featureSourceURL=' + featureSourceURL + '&geometry=' + UrlEncode(new_geometry) + '&featureAttributes=' + UrlEncode(Text(new_attributes))
return link
If you don't want your popup to have a long url in it, you can use a text element to return the app link in a clickable link, or you could style it to use a button using a method like the one in this blog post.
I hope that helps!
Chris