cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerAppsJunkie
Helper II
Helper II

How to determine status code for a condition

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?

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

 

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
RezaDorrani
Dual Super User II
Dual Super User II

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

v-bacao-msft
Community Support
Community Support

 

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@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?

This is REALLY useful, thank you 🙂

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

JasonWS
Frequent Visitor

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

 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (3,566)