web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Avoid writing multiple...
Power Automate
Unanswered

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

(0) ShareShare
ReportReport
Posted on by

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"

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,856 Most Valuable Professional on at
    Re: Avoid writing multiple variables using Parse JSON (or any other action)

    Hi @Anonymous 

     

    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

  • Community Power Platform Member Profile Picture
    on at
    Re: Avoid writing multiple variables using Parse JSON (or any other action)

    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

  • abm abm Profile Picture
    32,856 Most Valuable Professional on at
    Re: Avoid writing multiple variables using Parse JSON (or any other action)

    Hi @Anonymous 

     

    Here it is

     

    image.png

     

    Above the Parse JSON is as follows:

     

    {
        "type""array",
        "items": {
            "type""string"
        }
    }
     
    Thanks
  • Community Power Platform Member Profile Picture
    on at
    Re: Avoid writing multiple variables using Parse JSON (or any other action)

    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

  • abm abm Profile Picture
    32,856 Most Valuable Professional on at
    Re: Avoid writing multiple variables using Parse JSON (or any other action)

    Hi @Anonymous 

     

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

     

    image.png

     

    See my mapping

     

    image.png

     
  • Community Power Platform Member Profile Picture
    on at
    Re: Avoid writing multiple variables using Parse JSON (or any other action)

    Hello,

     

    That screenshot you mentioned is the result of the flow.

    I have the same thing as you.

    Capture224.PNG

  • abm abm Profile Picture
    32,856 Most Valuable Professional on at
    Re: Avoid writing multiple variables using Parse JSON (or any other action)

    Hi @Anonymous 

     

    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

  • Verified answer
    Community Power Platform Member Profile Picture
    on at
    Re: Avoid writing multiple variables using Parse JSON (or any other action)

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard