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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trigger Condition or J...
Power Automate
Answered

Trigger Condition or JSON If Statement? Instant Flow should run but dependent on item chosen in choice column

(0) ShareShare
ReportReport
Posted on by

I have an instant flow programmed in a column as a button (with JSON) that when ran it will populate a Word Template.

 

I have choice column named Template with 11 different choices that should trigger to 11 different Word Templates.

Depending on the Template chosen, I'd like the button run the correct flow.

Choose Template1, then click button, run flow Template1.

Choose Template2, then click button, run flow Template2, etc.

Is this possible?

 

spin24web_0-1666468780446.png

spin24web_1-1666468838267.png

 

Within the Format Column of the instant flow button, I figured I need a nested if statement in the JSON at "actionParams" but just can't get it to work. Maybe I'm going at it all wrong?

 

spin24web_3-1666469390124.png

 

I tried to just test two different flow ID's in the if statement as a test but get the error:

Unexpected token '=', "=if([$Temp"... is not valid JSON

 

"actionParams": "=if([$Template] == 'Template1’, {\"id\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx001\"}, {\"id\": \" xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx002\"}"

 

 

Categories:
I have the same question (0)
  • Verified answer
    grantjenkins Profile Picture
    11,063 Moderator on at

    Try the code below:

    "=if([$Template] == 'Template1', '{\"id\": \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx001\"}', '{\"id\": \" xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx002\"}')"

     

    Three things different to yours:

    1. You had a formatted single quote after Template1. Maybe you copied it from somewhere else.
    2. You didn't include the outputs in single quotes.
    3. You were missing a ) to close off the if statement.
  • AD-22072132-0 Profile Picture
    on at

    Well, it is now valid JSON, but it is always false, triggering the second id.

    Column is Template, choice is Template1, why isn't it seeing as true?

     

    "actionParams": "=if([$Template] == 'Template1', '{\"id\": \"xxxtruexxxx\"}','{\"id\": \"xxxfalsexxx\"}')"
     
    spin24web_3-1666498525795.png

     


     


     


     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    When I copy your code directly into my list it works successfully.

     

    Three things to check:

    1. Is Template the internal name of the column, or was it renamed? Your JSON refers to the internal name, not the display name.
    2. Are you sure you don't have a space or something after your Template1 value?
    3. Can you try one of the other choices to see if one of them work?
  • AD-22072132-0 Profile Picture
    on at

    First thing you suggested was the issue. It had been renamed just for this testing. I modified the code to that 'internal name' and it now works.

     

    Now to create the 11 deep if statement!

     

    Thanks.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    Great it's now working 🙂

     

    Why do you need a 11 deep if statement? I thought you were going to have individual flows for each of the Templates?

     

    If you do need to go that deep, then I'd suggest looking at using a Switch action instead. But still not sure why you would need a conditional statement at all.

  • AD-22072132-0 Profile Picture
    on at

    Heck, I do think it is a bit psychotic to create an 11 deep nested if statement.

    My logic was to have that if statement run until it found the true scenario, then it would run that flow.

     

    I'm figuring to have 11 flows since there are 11 unique Word template documents that could be populated depending on the 11 choices in the Template column.

     

    I suppose I could do one flow, with a Switch action on the Template Value and 11 Cases. A bit less insane.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 1,027

#2
Valantis Profile Picture

Valantis 809

#3
Haque Profile Picture

Haque 645

Last 30 days Overall leaderboard