Use two referenceContext in FieldMaps integration

781
6
Jump to solution
05-07-2021 09:19 AM
Antonio-Paruta
New Contributor III

Hi everyone, 

I added Field Maps as Workforce integration building a URL (I'm using ArcGIS Enterprise 10.8.1).

I need to open Field Maps in a specific point (${assignment.location} as reference) and pass some values to the selected feature. Browsing in the documentation I found that for the first action I needed to use referenceContext=search and for the second one referenceContext=addFeature. 

I'm able to use these two actions individually, but not together. 

Below the two URLs that I used:

- 'https://fieldmaps.apps.app?itemID=<mapID>&referenceContext=search&search=${assignment.location}'

- 'https://fieldmaps.apps.app?itemID=<mapID>&referenceContext=addFeature&featureSourceURL=<serviceURL>&...'.

Is there a way to merge  these two actions?

Thanks, 

Antonio

0 Kudos
1 Solution

Accepted Solutions
CraigGillgrass
Esri Regular Contributor

To follow-up Colin's post - here's an example of the url scheme to call Field Maps, create a new feature at the location of the assignment, pre-populated with the Work Order ID (serviceRequestField)

https://fieldmaps.arcgis.app?itemID=<Web Map ItemID>&referenceContext=addFeature&geometry=${assignment.latitude},${assignment.longitude}&featureSourceURL=<url to feature layer to create feature in>&featureAttributes=%7B%22serviceRequestField%22:%22${assignment.workorderid}%22%7D

 

View solution in original post

6 Replies
CraigGillgrass
Esri Regular Contributor

Hi @Antonio-Paruta since this has to do with the app you're calling, Field Maps, I'm going to move your question to that forum and will let the Field Maps team know.

Craig

ColinLawrence
Esri Regular Contributor

Hi @Antonio-Paruta ,

When passing a URL to Field Maps, only one referenceContext can be used. Can you clarify what you are trying to do? It sounds like you want to open Field Maps to a specific, existing feature. If you want to edit this feature you would use updateFeature which would center and select that feature when Field Maps is opened and allow you to pass attributes and update geometry if necessary. If you want to create a new feature you would use addFeature where you could pass specific geometry if you wanted the feature placed in a specific location; otherwise it uses your GPS location by default. Does this help provide you some guidance?

 

Regards,

Colin

0 Kudos
Antonio-Paruta
New Contributor III

Hi Colin, 

I'll try to explain my workflow:

- I start the assignment in Workforce; 

- I click on the button that I created through API to open Field Maps;

- Field Maps should be open in the same point of the assignment and then I need to add a point on the map to collect the information of the smart form that I developed.

- At the same time the field 'work order id' should be pass from Workforce to the field 'id' in Field Maps. 

 

I hope to be clearer than before. 

Thanks, 

Antonio

0 Kudos
ColinLawrence
Esri Regular Contributor

Thank you, that helps! So it sounds like you will want to use referenceContext=addFeature. You can then use the geometry parameter to pass in the point geometry (location) of the feature and featureAttributes to pass the work order ID field. Take a look at the second example under Initiate capturing a feature. This gives an an example of a URL using a similar structure to what you want. 

 

Regards,

Colin

CraigGillgrass
Esri Regular Contributor

To follow-up Colin's post - here's an example of the url scheme to call Field Maps, create a new feature at the location of the assignment, pre-populated with the Work Order ID (serviceRequestField)

https://fieldmaps.arcgis.app?itemID=<Web Map ItemID>&referenceContext=addFeature&geometry=${assignment.latitude},${assignment.longitude}&featureSourceURL=<url to feature layer to create feature in>&featureAttributes=%7B%22serviceRequestField%22:%22${assignment.workorderid}%22%7D

 

Antonio-Paruta
New Contributor III

Thanks Craig, 

it was exactly what I was looking for.

Antonio

0 Kudos