Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 7v0m4YOLCT4qbqLozka0DI
Power Automate - Building Flows
Answered

How to determine status code for a condition

Like (0) ShareShare
ReportReport
Posted on 6 Sep 2019 05:10:41 by 149

I want to put in a condition that checks the output status code of the step above it.


So if it's output status code is 200 it's yes but if it's output status code is 404 then it's no.

What would be the syntax to have a condition step read the "Status Code" of a prior step and take action based on this?

  • JasonZF Profile Picture
    570 on 12 Apr 2022 at 11:39:01
    Re: How to determine status code for a condition

    Worked great for me. In my case, I am reading the output of an 'Add member to group' action using

     

    outputs('Add_member_to_group')['statusCode']

     

    My only problem now is how to get a list of status codes. Is it action-specific?

     

    JasonWS_0-1649763435713.png

     

  • Nielf Profile Picture
    306 on 25 Mar 2022 at 06:26:15
    Re: How to determine status code for a condition

    @v-bacao-msft do you know if this has changed since you posted this? I can't get this to work using the statusCode property. 

  • jimbul Profile Picture
    20 on 31 Oct 2019 at 02:25:30
    Re: How to determine status code for a condition

    This is REALLY useful, thank you 🙂

  • PowerAppsJunkie Profile Picture
    149 on 06 Sep 2019 at 11:52:37
    Re: How to determine status code for a condition

    @v-bacao-msft That worked great!

    I have a question though.  Is there a reason to use it in compose vs just putting that statement in the expression of the condition?

     

    I used it both the compose and the condition and it worked both ways.

     

    Also if I wanted to check the output of say Body instead of statusCode would I use ['Body']?  Is there a reference for outputs that I can lookup so I know what I can grab from the output of an action?

  • Verified answer
    v-bacao-msft Profile Picture
    on 06 Sep 2019 at 09:24:53
    Re: How to determine status code for a condition

     

    Hi @PowerAppsJunkie ,

     

    You could try the following method to get the status code.

    • Configure Compose action under the specified action to get the status code.
    outputs('ActionName')['statusCode']
    • If the action name contains a space, replace the space with "_".
    • Set Configure run after, continue to execute the following action when the above action runs successfully and fails.

    Image reference:

    132.PNG

    133.PNG

    Hope it helps.

     

    Best Regards,

  • RezaDorrani Profile Picture
    12,141 on 06 Sep 2019 at 05:17:57
    Re: How to determine status code for a condition

    Hi @PowerAppsJunkie 

     

    So lets say you have an http request action and you need to fetch the response status code

     

    you can use expression

    body('HTTP')?['statusCode']

     

    You can share screenshot of your action which produces the status code response if you want the exact expression

     

    Regards,

    Reza Dorrani

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,763 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard