Survey123 Geopoint Information - Send email via Geoevent

1318
8
01-15-2020 07:36 AM
MikeGeorge1
New Contributor II

We created a simple Survey123 web form with Geopoint information to report fence breaks. Once a report has been made, we have configured Geoevent to send an email to notify the submittal. The workflow works great, except to send the Geopoint information (Lat/Long/Web) in the email. 

We are using the code below in the message box of the Geoevent Output connector. 

${location|getValue:"x"}

${location|getValue:"y"}

The X and Y is blank in the email notification. Please advise. 

0 Kudos
8 Replies
EricIronside
Esri Regular Contributor

Hey Mike,

I have a couple of suggestions for you:

Your first option is to use the Add XYZ Values Processor in your GeoEvent Service to add the X and Y fields to your events. Then use those fields in your email output format instead of trying to dereference the XY from the geometry.  

Second, I don't know your exact use case for reporting the lat/lon to a user in an email, but if the intent is to allow them to pull it up in a web map, I would replace those coordinates with a link to a web map. To make this even more effective, you can add a search capability to your web map, use URL parameters in a web map, application, Ops Dashboard, or Web App Builder to take the email recipient to a map and have it zoom directly to (and even open a popup) the Survey123 in question. 

ahargreaves_FW
Occasional Contributor III

Hi @EricIronside 

I'm trying to do exactly as describe in your second option above; use  URL parameters to provide a dynamic link to the newly submitted feature. However, despite adding a question to my survey to capture the LAT/LONG of the geopoint that info is not accessible via power automate. Further, the OID or GlobalID are not seachable fields that can be used in a URL parameter. Any advice on how to construct a dynamic URL to zoom directly too a feature?

0 Kudos
EricIronside
Esri Regular Contributor

Hey @ahargreaves_FW 

Search fields must be of type integer or string. The easiest thing to do might be to create a new String field named UniqueID and Field Map/Field Calculate the GlobalID into that new field in GeoEvent. Then in your webmap you can set up the searchable field to be the string field UniqueID and set up the URL parameters as needed.

Best

Eric

0 Kudos
MikeGeorge1
New Contributor II

Thanks for your reply, Eric. Just to follow up, how do I replace the coordinates with a link to a web app?

0 Kudos
EricIronside
Esri Regular Contributor

Hey Mike,

1. Create a new Web Map that contains the data you want to view (Survey123 points and any other layers).  After you save the web map, note the ID.  You can use it in the following URL (test the URL in a browser to be sure it opens the correct web map):

https://www.arcgis.com/home/webmap/viewer.html?webmap=[WebMapID]

2. Back in your GeoEvent Server, use the Add XYZ processor in your GeoEvent Service to add the XY fields (use field named LAT for your y coordinates and LON for your X coordinates) to your events before sending them to the email output.

3. Update your email output message body to include the following URL (adjust the level to the zoom level needed):

https://www.arcgis.com/home/webmap/viewer.html?webmap=[WebMapID]&center=${LAT},${LON}&level=4 

And that's it. 

Some advanced things you can do:

- In step 3, if your message body is HTML, you can use an HTML link instead of the URL:  <a href='https://www.arcgis.com/home/webmap/viewer.html?webmap=[WebMapID]&center=${LAT},${LON}&level=4'>Click Here to Open Web Map</a>

- In step 1, you can follow the instructions on adding search capability to your web map (see my last reply) and instead of using the LAT/LON/Zoom to center your map, you can go to the search item directly using a URL: https://www.arcgis.com/home/webmap/viewer.html?webmap=[WebMapID]&find=${[The field name in your event that contains the ID of the item in the searchable layer]}

Best,

Eric

MikeGeorge1
New Contributor II

Hi Eric,

Thanks for the workflow. We have Geoevent 10.6.1 and I believe it does not include the Add XYZ processor.

I tried a different workflow, but here's a quick overview as to what I am trying to do. 

I have a Survey123 form that our staff uses to report incidents/permit points. Once a user submits a forms, it add a point and other info to the feature service. Instead of a webhooks, I use Geoevent to send an instant email. This works great, however the email does not communicate the Geopoint information/map. For now we use ${geometry} that gives an output like {"x":-106.56903598999997,"y":35.20867293200001,"spatialReference":{"wkid":4326}} in the output email. 

Now with what you suggested, to make a web map link and not having the Add XYZ processor, I tried doing:

Added field x and y (double) to service

Input > field calculator processor from geometry > field mapper processor > Output. 

Geoevent Workflow

Once I have the lat and long calculated, I will create a web link in the email body. But the output email still has blank x and y. Any advice? 

0 Kudos
EricIronside
Esri Regular Contributor

Hey,

At 10.6.1 you can add the processor manually. Unzip the release below and place the .jar file into your <ArcGISServerInstall>/geoevent/deploy directory. Note that the version on the .jar file (1.5.1) doesn't have to match your GeoEvent version. 

https://github.com/eironside/defense-solutions-proofs-of-concept/releases/download/10.5.1/addxyz-pro...  

Hopefully that will work, if not, we'll have to take a look at your field calculation.

Best,

Eric

MikeGeorge1
New Contributor II

Excellent! Thanks much Eric. It works great and as intended. Just need to figure out to modify the output email html code to limit decimal places for the lat/long. I appreciate your assistance.

0 Kudos