Hi there,
I am trying to pass a variable that I've grabbed from JSON as part of a URL in a final email message. I have set it as a variable, but when it comes through in the email it includes extra characters instead of just the value, so the URL does not work. The Lat/Longs that I am grabbing will change every time the flow is run, which is why I need a dynamic URL. Is there any way to get the variable to just be the plain value when used? I hope this makes sense. Thanks for any help
In the raw JSON:
In the flow email body:
In the email when the flow is run (the extra [{"Lat: ... }] make it not work):
What I need it to be in the email:
https://www.google.com/maps/search/?api=1&query=44.398393572382815%2C-76.5817716416928
Solved! Go to Solution.
I figured it out by using Compose instead of Select and structuring a bit differently. Thanks so much for your help!
Hi @khutchi
Add a Parse JSON and pass the input as your JSON data which contains Lat and Long values. Later in your email step map the values. Could you post a sample of your JSON Data for Lat and Log variables. I am a bit lost about the geometry JSON you mentioned above.
Thanks
Thanks
If you liked my response, please consider giving it a thumbs up
Proud to be a Flownaut!
Learn more from my blogThe Lat and Long variables are JSON arrays.
You can use expressions to extract the Latitude and Longitude from your variables:
This should produce the following URL:
Ellis
I had a good feeling about this but it's not quite working - I am getting the following error:
The input for the variable is this body - since I'm only selecting part of the array is it turning the return into a string?
Sorry for my very rudimentary knowledge...this is my first time using PA and JSON. Let me know if you need any more details
Can you show me the variable and the full JSON data that it holds:
It should be a matter of adjusting the expressions:
Ellis
The full JSON that parsed earlier in the flow is here:
{
"layerServerGens": [
{
"id": 0,
"serverGen": 521869
}
],
"transportType": "esriTransportTypeUrl",
"responseType": "esriDataChangesResponseTypeEdits",
"edits": [
{
"id": 0,
"features": {
"adds": [
{
"geometry": {
"x": -76.5817716416928,
"y": 44.398393572382815
},
"attributes": {
"objectid": 81,
"globalid": "FF9428D9-4FE6-411D-BD8F-5EE6333BB8E9",
}
}
],
"updates": [],
"deleteIds": []
},
"attachments": {
"adds": [],
"updates": [],
"deleteIds": []
}
}
]
}
This is the flow at the stage of the Lat/Long stuff:
I am using Select (called "LatY") to only grab the Lat from the full JSON, then assigning that selected value to the variable created earlier (called "Lat Variable"). The variable is what I'm trying to put in the URL in the final email. Maybe there is a way less convoluted way to set this up...
Can you show the variable names and content type (is it an array or string?) by expanding these actions:
What is the name of the variable that stores the full JSON?
Once we understand the data structure - the expression can be adjusted to suit the data structure.
Ellis
Here they are expanded - I did try changing the type to array but I got an error. I can recreate that if you want.
Everything above the Lat Long variable steps is coming straight from this tutorial (https://www.esri.com/arcgis-blog/products/field-maps/field-mobility/use-webhooks-to-automate-workflo...) - hopefully that helps you understand the structure. The full JSON is coming from a webhook on an ESRI features service when a feature is added.
I figured it out by using Compose instead of Select and structuring a bit differently. Thanks so much for your help!