Hello this is going to be a bit of a long read, so bare with me please, I'll try keep it as concise as possible.
Want I originally wanted to do :
- When a document is first created in a sharepoint document library, the user will request an approval through sharepoint manually, specifying the approval assigner.
- When the same document is modified in the future, an approval will be automatically generated and sent to the previous approval assigner.
To achieve this, I used a power automate flow to detect when a document is modified, recover the previous approval assigner and resend an approval request.
However I encountered a problem where, when a document is modified, the approval assigner is immediatelly deleted and the approval status is reset.
I therefore had to recover the approval assigner by using an HTTP request to obtain the previous versions of the document and extract the previous approval assigner from the JSON output...tiresome...
But the power automate approval process, doesn't update the sharepoint approval status column, so I then had to use a setapprovalstatus function to update it.
However another problem occurs, which is when a document is created, requesting a manual approval updates the approval status column, which is considered a modification, so my modification automation would be triggered, causing a double approval to occur everytime a manual approval request is made.
So I decided to scrap that idea, and create my own approval process using power automate, by creating my own 2 columns of approval status, and approval assigner.
- I would automatically generate an approval request when a document is created.
- When a document is modified automatically generate an approval request to the previous approval assigner.
However new problem occurs, to be able to automatically generate an approval request in power automate, the approval assigner has to be known in advance, which is therefore useless to me, because in my case, it cannot be known in advance.
So I'm stuck, how the hell do I do this ? It seems so simple in concept but ridiculously difficult technically.
I attached to images just for context, forgive me the language is french because I work in france. Approval is called approbateur in french.