I am creating a leave system for my company using Microsoft flows. I have a requirement that the leave request should be forwarded to the approver even if it is a new or edited one. I have attached two images that will give a brief knowledge about the workflow I created.
I am using 'Created=Modifed' condition to check if the list item is newly created or it is going to update. The flows are working absolutely fine. However, the flow keeps on triggering even if the item is updated and keeps sending mail to Approver to approve/reject the request and it keeps on going until I have to forcibly delete the item from the list.
I read few of the solutions or work-arounds from Community, however nothing has helped so far. Can someone help me with this? (Platform community says the issue has been resolved, I don't see that in my Sharepoint Online)
If I am understanding your scenerio correctly it sounds like you may need a condition in there to check a status of some sort and then status needs to be updated with the item has been marked as approved or denied or whatever it may be.
I use a status column on all my lists and often they are for nobody but me to use for Flow actions.
Hopefully, a condition that would terminate this ever going invisible infinite loop of item updation. The main aspect of the problem is the existing item that has been approved/rejected can be updated to approved/rejected by the approver. For example: If you are approver and I am a requestor, and you already rejected my leave request at first just because I asked for more number of allowed leave hours. Then I should be able to resubmit the request by updating the number of hours and you can approve it. If you are thinking about the status as Pending, Approved and Rejected, then I have already implemented it. The main concern is the infinite loop which keeps on running and sending infinite emails to approver in spite of approver approves/rejects the updated leave request.
If the conditon is being looked at before the email is sent as says to only send the email if the condtion is still showing Pending then it should not be running in a loop.
Even if and can be Rejected and then modified that shouldn't matter because when it is Rejected that will be the status so it won't send an email...when the person requesting it makes a modification then the status should be changed back to "Requested" and then it is back to sending an email.
If you have the status condtion in there and it is still running the loop I'm thinking you either need to move the condition up higher in your Flow or you Condition isn't working....might need a single quote on each side of the text or something.
I get you. If you open the leavereq_workflow_1.png, there is a connector called Update Item 9 which is configured as shown in the attachment. So when either item is created or existing, it actually goes to pending state at first (reason because I want to show the 'Pending' leave status value to requestor in order to convince him that his request is travelling through the configured flow).
However, even if the updated item gets approved/rejected at the second instance, just because of infinite looping it goes back to pending state again, all because of the trigger 'When an item is created or updated' and it couldn't find any other trigger that checks if item is updated in list
From your screen shots it looks like your trigger is When an item is created or modified and then your very first step after that is changing the step (no matter what it is) to Pending which is going to make the Flow keep going on forever and ever. You need the actions below to decide what to change the status to and when and you need a condtion there at the top that says if the status is Pending don't go any further.
If your condtion is done correctly and the status on the item is Pending it will not do anything past that point. To check this trigger the Flow on one that is Pending and then look at the run and it should say 'false' there...if it does it will stop at that point and if it does not...something is wrong and you need to get that condition working correctly.
How can the 'Pending' status keep running the trigger forever? This value comes from my custom-made column called 'Leave Status value' which has no relation with 'Content Approval' if you think this 'Pending' is coming from Content Approval. And yes I enabled Content-Approval on my list. An 'approval status' column is there but it shows nothing. Therefore I had to create a column called 'Leave Status value' myself which does the same thing as the later but it's doing it using workflow.
This is a pretty good Blog post on what is happening. You are telling it to do this action when anything is modified and then you are modifying the item on your very first step so that is then completing the steps and running it again and again..and so on.
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!