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

SharePoint Approval with Create or Modify as trigger

I am trying to setup a new flow to set SharePoint Content Approval status, that is triggered by a file creation or the modification of the file that is in a Document Library with major versioning enabled. So far the flow is going like this: 1. Document is created or modified 2. Document moves to Pending status 3. Flow starts the Approval 4. User chooses to approve 5. Document status is changed to Approved (This is the point where I want everything to stop, but it doesn't.) 6. Now the Approval Flow is initiated again (I assume this is happening as a result of the document status change from Pending to Approved.)

 

The main problem I have is this leaves a new approval flow opened for documents in "Approved" status.

 

I am attaching a screenshot of my flow for reference.

2018-01-29_09-10-02.jpg

3 REPLIES 3
Community Support Team
Community Support Team

Re: SharePoint Approval with Create or Modify as trigger

Hi @ bvol,

 

This issue is confirmed on my side.

 

We could add a “Condition” before “Start an approval”, only when the file‘s status is Pending, You could “Start an approval”, otherwise,if the file’s status is not Pending, do nothing.

We couldn’t use the system automatically generate field “Approval Status” in the “Condition”, so we could add a field in the list to record the file’s Approval Status.

 

I have made a test on my side, you could add a “file status” column in the Sharepoint library as screenshots below:

 

 1.jpg

 

 

The “file status” column is a choice type column, the column‘s value could be “Approved” , “Rejected” or “Pending” ,the column‘s default value is Pending.

2.png

 

You could create a flow following steps below:

  1. Add a trigger “When an item is created or modified (properties only)”, fill in your Site Address and Library Name.
  2. Add a Condition, the first value set to the “file status Value” dynamic content of the trigger, the second value set to “Pending”, the condition in the middle select “is equal to”.
  3. Inside the If yes branch of Condition, add action “Start an approval”, choose an Approval type, fill in the “Title” and “Assigned to” field.
  4. Add a Condition under the “Start an approval” action, the first value set to the Response dynamic content of “Start an approval” action, the second value set to “Approve”, the condition in the middle select “is equal to”.
  5. Add a Condition2, the first value set to the Response dynamic content of “Start an approval” action, the second value set to “Approve”, the condition in the middle select is equal to.
  6. Inside the If yes branch of Condition2,Add action “Update item”, fill in your Site Address and Library Name, fill in the ID dynamic content of the trigger in the “Id” Field, fill in the Title dynamic content of the trigger in the “Title” Field, choose Approved in the “file status Value” field.
  7. Add a “Get file metadata” action under the “Update item” action, fill in your Site Address, choose the “Identifier” dynamic content of “Update item” action in the “File Identifier” field.
  8. Add a “Set content approval status” action under the “Get file metadata” action, ”, fill in your Site Address and Library Name, choose the ID dynamic content of the trigger in the “Id” Field, choose Approve in the Action field, choose the “Comments” dynamic content of the “Start an approval” action, choose the “ETag” dynamic content of the “Get file metadata” action
  9. Inside the If no branch of Condition2,Add action “Update item2”, fill in your Site Address and Library Name, fill in the ID dynamic content of the trigger in the “Id” Field, fill in the Title dynamic content of the trigger in the “Title” Field, choose Rejected in the “file status Value” field.
  10. Add a “Get file metadata2” action under the “Update item2” action, fill in your Site Address, choose the “Identifier” dynamic content of “Update item2” action in the “File Identifier” field.
  11. Add a “Set content approval status2” action under the “Get file metadata2” action, ”, fill in your Site Address and Library Name, choose the ID dynamic content of the trigger in the “Id” Field, choose Reject in the Action field, choose the “Comments” dynamic content of the “Start an approval” action, choose the “ETag” dynamic content of the “Get file metadata2” action.

 

Image reference:

 3.jpg4.jpg

 

When a file is created in the library, the flow run successfully as below:

 5.jpg

 

The screenshot of the new created file’s status in the Sharepoint library as below:

 

 6.jpg

 

Note: The flow would work when a file is created in the library, I am afraid it is difficult for the flow to “Start an approve” with updated file in this situation, because the “Approval Status” and “file Status” of a file in the library would always be “Approved” or “Rejected”, you could not “Start an approve” with the file again.

 


Regards,
Alice Zhang

vwyankee
Level: Powered On

Re: SharePoint Approval with Create or Modify as trigger


@v-yuazh-msftwrote:

Note: The flow would work when a file is created in the library, I am afraid it is difficult for the flow to “Start an approve” with updated file in this situation, because the “Approval Status” and “file Status” of a file in the library would always be “Approved” or “Rejected”, you could not “Start an approve” with the file again.

 


Regards,
Alice Zhang


 

Thanks for documenting this out, Alice. It was extremely helpful as I kept getting errors because I didn't have a value in the eTag part of the "Set Content Approval Status" step. I needed to add the step to get the file metadata with the "Identifier" dynamic data, which then gave me the "eTag" dynamic data as an available choice in the Set Content Approval Status step.

 

One difference in my design allows for this to work for any version of the file, not just on the new document creation. I am using a Yes/No column to trigger the approval that's called For Review. The default value is No and the author/editor just has to change this to Yes to start the approval process. My update item step - right after starting the condition for if the approval response equals approve is setting this For Review column value back to No for both branches. I would add screenshots but I don't see an option to do that, but it's just replacing the choice column you have File Status with the Yes/No column For Review. Any time this is set to yes the approval proceeds and will set it back to No with either outcome of the approval since it is no longer "for review."

 

 

Chr0nicBit
Level: Power Up

Re: SharePoint Approval with Create or Modify as trigger

Thanks for this guys. It helped me out creating our flow, we had the exact requirements of the OP.

 

Do you know what is really needed is the option to set an action to NOT trigger another flow e.g. Tick box "Allow action to trigger another flow".

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,934)