I am sending the screen shot of the Flow.
In my flow when a file is added or modified, it should trigger.
I have made the Content Approval Settings on.
My requirement is according to the classification (Custom choice Field) selection, it goes approval managers to approve the document.
The flow i did as follows:
1. Call the action when the file is added or modified.
2. Get the File Metadata (here in the FileIdentifier i added Identifier value)
3. Initialize the classification variable
4. Set the variable of Classification which i selected from the form.
5. Check the condition if the document uploaded needs Approval process, as we have the requirement that all the documents should not go for the approval process.
6. Switch action to start the approval process according to the classification selected.
7. For the case "Architecture" , i call the content approval status to set the the Approval Status as "pending".
8. call the "Start an Approval" .
9. Condition to check the Response.
a. If Response is "Approve", again call the content approval status to set the value as "Approved"
b. Send the mail.
c. If Response is "Reject", again call the content approval status to set the value as "Reject"
d. Send the mail.
Now the issue is suppose i added a file, with all my valid metadata, it starts the Approval process, and its status is "Pending" , sending a mail
Now again i add 2nd new file, it starts the approval process and its status is "Pending" , and send an approval mail to the approver, but at the same time a new instance of previous item, flow starts the approval process, and a mail is sent again for the previous item.
But if i status is "Approved" after approving by the approver, that items instance is not triggering.
Hence, if there are 2 files which is "Pending " state, and third file is added into the library, 3 approval mails are recieved or 3 instance is creating.
But if there are 2 files , one is "Pending " and other is "Approved" and a third file is added in the library, 2 approval mails are recieved or 2 instance is created.
Appreciate your help to figure out my mistake.
Is it possible that the updates that you are making within the Flow actions are then triggering the process to execute as they are modifications to the Sharepoint file?
When you perform your check to see if the file has the ApprovalRequired flag set to True it may also be worth checking the Approval Status of the item as well. If the status is "Pending" or "Approved" then the approval process does not need to be triggered. This will ensure that any items that have approval pending are not processed a second time.
Thanks for your reply.
I cannot get the field "Approval Status" to set it as Condition.
"Approval Status" filed is the field appeared after enabling the Content Approval in the list settings.
Please let me know if i need to enable it from any configuration.
Thanks and Regards
Also it will be nice if you could let me know that why a new instance of "Running" is generating of an existing item, which is already in "Pending" state. Did i make a mistake or have not configued in the Library or Flow?
What fields are you setting within the step indicated below, where you are setting the Approval Status to "Pending"? I think the field you are setting to Pending is the one that needs adding to your check condition (its likely not called Approval Status).
Looking at the details of the step, as long as the action value "Submit" is not the default value for a new item you can check this field in your condition. You would want to add an additional clause to the condition to check that the "action" field of the Sharepoint item is not Submit or Approve. Essentially, once the action field has been set to either of these values it needs to be ignored in the Approval process if the item is updated further, as the approval would already have been sent.