cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
BlueCar
Level: Powered On

Reading Approval Status

Hi All,

This is not a question, but a solution to a problem I have had: Reading the Approval Status. There are a few guides to getting this to work, but I kept running into problems, so I swore that I would write a guide here, when I finally found something that worked for me.

Problem: You want your Flow to be able to read the built-in Approval Status column, that is not available for Flow.

Solution:

I will go though each action an explain. The solution is a two-step solution, as we need to get som info out midway, that we need to configure an action later in the flow.

1.

First we make a call to the SharePoint list and get the Status.

image.png

Uri: _api/web/lists/GetByTitle('Documents')/items(<ID of element>})?$select=OData__ModerationStatus

Headers:

Accept                application/json; odata=verbose

Content-Type     application/json; odata=verbose

Body: body('Send_an_HTTP_request_to_SharePoint' )['OData__ModerationStatus']

(I have to admit, that I really don't know what I'm doing in the Body section)

 

2.

This step might be skipable, and you can just use the code from step 3.

Send the result of HTTP request action to your e-mail. This send e-mail action is only temporary and will be deleted later.

image.png

Body: Concat function is this: concat(body('Send_an_HTTP_request_to_SharePoint'))

 

3.

Run the flow on an item in your document library and recieve the e-mail. The data should look something like this:

{"d":{"__metadata":{"id":"e6ad8e94-985d-4eb3-93c7-ff233a277874","uri":"https://XXX.sharepoint.com/sites/YYY/_api/Web/GetByTitle('Documents')/Items(7)","etag":"\"6\"","type":"SP.Data.Shared_x0020_DocumentsItem"},"OData__ModerationStatus":2}}

Copy all of this, as it is needed soon.

 

 

4.

Delete the Send an email action - we don't need it anymore.

 

5.

Insert the Parse JSON action, so we can convert the recieved data to something usefull.

image.png

Insert the Body from the HTTP Request.

Now, press the "Use sample payload to generate schema" in the buttom of the Parse JSON action.

Indsert the data you got in your e-mail:

image.png

Press Done and the result will show itself in the former window:

image.png

 

6.

Done!

You can now insert the ID of the Approver Status into your flow:

image.png

 

7.

Bonus

If you have trouple using the format of the data in your actions, you can convert it with the Compose Action.

image.png

Insert the variable - and have "" around it.

 

Let me know if you have any problems with this.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Reading Approval Status

Hi @BlueCar,

 

Thank you for your sharing.

It is a smart solution and I believe many people would benifit from it.

 

Best regards,

Alice

7 REPLIES 7
Community Support Team
Community Support Team

Re: Reading Approval Status

Hi @BlueCar,

 

Thank you for your sharing.

It is a smart solution and I believe many people would benifit from it.

 

Best regards,

Alice

Santosh_M
Level: Powered On

Re: Reading Approval Status

Hello,

 

Thanks for posting this. Looks like something i can use to troubleshoot. But can you please share the complete workflow?

 

I also had issue with configuring Uri as the Output value is not clear? How did you get it?

 

Thanks,


Santosh

bpmpower
Level: Powered On

Re: Reading Approval Status

Nice post.  Thanks for sharing.  I am working with document sets in a document library with Sharepoint content approval enabled.  I face the same issue.  Does your solution work for items in document library?  I tried but I think /_api/web/....

 

Thanks.

bpmpower
Level: Powered On

Re: Reading Approval Status

Hi @BlueCar 

Is it possible to post your entire FLOW and expand each step if possible please?

 

Thanks

CindyZ
Level: Powered On

Re: Reading Approval Status

I am getting this message: "A potentially dangerous Request.Path value was detected from the client (&ltSmiley Wink."  It then lists the clientrequestID and the servicerequestID.  I've checked everything over several times and the only thing I see different is that you have the purple "output" indicator on your Uri  line while I only have what in indicated in your text as text - <ID of element>.

 

Thank you. 

BlueCar
Level: Powered On

Re: Reading Approval Status

Hi @bpmpower@Santosh_M and @CindyZ 

I don't have that flow anymore, but what I have posted is what was in the flow. I'm busy at the moment, so I don't have time to create a new sample flow.

The solution was created to handle approvals of documents in a documentlibrary.

Sorry about the missing explaination of the "output" value in the first screenshot. It was simply the ID of the item being processed e.g. "104".

CindyZ
Level: Powered On

Re: Reading Approval Status

Thank you for the reply. 

Helpful resources

Announcements
firstImage

Microsoft Flow Online Conference

Join us for a FULL day of FREE Microsoft Flow Sessions from some of the best minds in the industry!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 40 members 4,400 guests
Please welcome our newest community members: