cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Avoid writing multiple variables using Parse JSON (or any other action)

Hello, I'm currently building a flow with teams' approval.

Depending on a sharepoint list value, the approvers will be different.

For example, if the departments concerned are football and fitness, the approval will be sent to each chief.

Instead of setting new variables, I'd like to know how to put together the if expressions.

 

Capture3_LI (3).jpg

 

 

 

 

Capture000.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

if(contains(body('Get_items')?['Department'],'Football'), 'footballboss@@.com', '')
if(contains(body('Get_items')?['Department'],'Basketball'), 'basketballboss@@.com', '')
if(contains(body('Get_items')?['Department'],'Handball'), 'handballboss@@.com', '')
if(contains(body('Get_items')?['Department'],'Hockey'), 'hockeyboss@@.com', '')
if(contains(body('Get_items')?['Department'],'Fitness'), 'fitnessboss@@.com', '')
if(contains(body('Get_items')?['Department'],'Others'), 'othersboss@@.com', '')
 

 

Capture2.PNG

 

 

Still thinking how to get the true values from Parse JSON

 

Finally getting the compose to "Assigned to field"

1 ACCEPTED SOLUTION

Accepted Solutions
Frequent Visitor

Hey,

 

Here is the final flow.

Don't forget to use the Parse JSON "Generate from sample" with your compose output.

Capture444.PNGCaptur445e.PNG

 

Thank you so much @abm

View solution in original post

8 REPLIES 8
Super User III
Super User III

Hi @pedrosf 

 

I am not sure about the JSON If statements you mentioned. You could do this via switch action step.

 

Declare a string variable called email. Then retrieve the items using Get Items. Add a switch action step to determine the category and store the email under the new variable. Finally send email using the variable which will have the email address.

 

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 blog

Power Automate Video Tutorials
Frequent Visitor

Hello @abm

 

Thank you for answering my request.

 

Capture111.PNGCapture112.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I've already flow with a switch setup but I dont'know if the cases "Equals" field triggers if the sharepoint values are written like this.

Capture3_LI (3).jpg

Hi @pedrosf 

 

Here it is

 

image.png

 

Above the Parse JSON is as follows:

 

{
    "type""array",
    "items": {
        "type""string"
    }
}
 
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 blog

Power Automate Video Tutorials
Frequent Visitor

Hello, 

 

Capture223.PNG

 

 

 

I tried for the last 3 hours to get this through but the "Equal" field doesn't detect the words in the "Expression result". 

It always goes to default.

(To get the "Outputs" in Parse JSON content filed, I had to put the dynamic content in Compose after)

Capture222.PNG

Super User III
Super User III

Hi @pedrosf 

 

I am pretty sure you are mapping the wrong mapping in your switch

 

image.png

 

See my mapping

 

image.png

 


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 blog

Power Automate Video Tutorials
Frequent Visitor

Hello,

 

That screenshot you mentioned is the result of the flow.

I have the same thing as you.

Capture224.PNG

Super User III
Super User III

Hi @pedrosf 

 

Thanks for the screen share. All we did is rearranged the flow similar like my earlier screenshot.

 

1. Extract the values from SharePoint

2. Parse JSON

3. Iterate each values

4. Switch 

 

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 blog

Power Automate Video Tutorials
Frequent Visitor

Hey,

 

Here is the final flow.

Don't forget to use the Parse JSON "Generate from sample" with your compose output.

Capture444.PNGCaptur445e.PNG

 

Thank you so much @abm

View solution in original post

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (6,204)