cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
khutchi
New Member

Passing variables as plain value

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:

khutchi_2-1632237906742.png

In the flow email body: 

khutchi_0-1632237688912.png

In the email when the flow is run (the extra [{"Lat: ... }] make it not work): 

khutchi_1-1632237715048.png

What I need it to be in the email:

https://www.google.com/maps/search/?api=1&query=44.398393572382815%2C-76.5817716416928 

1 ACCEPTED SOLUTION

Accepted Solutions

I figured it out by using Compose instead of Select and structuring a bit differently. Thanks so much for your help!  

khutchi_1-1632250142321.png

 

View solution in original post

8 REPLIES 8
abm
Super User
Super User

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



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
ekarim2020
Community Champion
Community Champion

The Lat and Long variables are JSON arrays.

ekarim2020_0-1632240929406.png

You can use expressions to extract the Latitude and Longitude from your variables:

ekarim2020_0-1632240244215.png

This should produce the following URL:

Example flow:
ekarim2020_1-1632241097972.png

 

Ellis
 

____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

I had a good feeling about this but it's not quite working - I am getting the following error:

khutchi_1-1632241735690.png

 

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?

khutchi_0-1632241686353.png

 

Sorry for my very rudimentary knowledge...this is my first time using PA and JSON. Let me know if you need any more details

ekarim2020
Community Champion
Community Champion

Can you show me the variable and the full JSON data that it holds:

ekarim2020_0-1632242842604.png

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: 

khutchi_0-1632243621821.png

khutchi_1-1632244176965.png

 

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... 

ekarim2020
Community Champion
Community Champion

Can you show the variable names and content type (is it an array or string?) by expanding these actions:

ekarim2020_0-1632244160437.png

 

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

 

khutchi_0-1632244698665.png

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!  

khutchi_1-1632250142321.png

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,465)