Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Extending flow past 30 days

(0) ShareShare
ReportReport
Posted on by 1,597 Super User 2024 Season 1

Hello!

 

I have built the below flow to extend an Approvals workflow past 30 days - I have followed @RezaDorrani's tutorial here

 

However it doesn't seem to be running as expected.

 

On the 'Apply to each 5' action, it is running through 100 records at a time and seems to be sending approvals to managers for the incorrect user in the SharePoint list even though 'Get user profile' is selected near the top of the workflow.

 

It's also been noted that approvals went out for people where the ‘FormStatus Value’ was not equal to "Manager Approval Needed" or "Exec Approval Needed".

 

Really could do with some help on this one.

 

sudosaurus_58-1678273783724.png

 

Full flow details below:

 

Trigger: When an item or a file is modified (SharePoint)

We start this workflow with the SharePoint ‘When an item or a file is modified’ trigger action.

We have two trigger conditions set for this.

 

The first trigger condition checks that the ‘FlowName Value’ in the Declarations list is set to “WF3” – this would’ve been set by the previous workflow if the user had answered ‘Yes’ to any of the specific questions when the update item action would have set the Colleague Date ‘FormStatus Value’ to “Exec Approval Needed” or “Manager Approval Needed”.

 

The second trigger condition checks that the ‘StartWF’ value is not equal to ‘No’  - later on this value will be set to ‘Yes’ – this will allow the approval workflow to restart after the Approvals action has timed out after 29 days of inactivity.

 

sudosaurus_0-1678271508918.png

sudosaurus_42-1678272057663.png

 

Action: Get items (SharePoint)

 

Here we are getting items from the ‘Colleague Data’ list.

 

sudosaurus_43-1678272088110.png

 

Action: Get user profile (V2)

Next, we retrieve the user profile details from the EmailAddress field in the ‘Declarations’ list – this is the email address of the user who submitted their Declaration of Interest.

sudosaurus_3-1678271559647.png

 

Action: Get Manager (V2)

Again using the EmailAddress field from the ‘Declarations’ list, we get the details of the users manager.

 

sudosaurus_4-1678271559651.png

 

Action: Apply to each

 

Next, we use the body value from the ‘Colleague Data’ list (Get items) and insert this into the ‘Output’ field in this ‘Apply to each’ action.

sudosaurus_5-1678271559652.png

 

Action: Get user profile.

Next, using the ‘ExecDirectorEmail’ value in the Colleague Data list we are able to retrieve the user profile of the Exec Director.

 

sudosaurus_6-1678271575057.png

 

Action: Switch

Next, we use the ‘Switch action’ which is compromises of three cases – each of which are dependant on the selected ‘FormStatus Value’ from the ‘Colleague Data’ list – these would’ve been selected from the second flow which checks which questions had been answered from the form.

 

sudosaurus_7-1678271575058.png

 

  • Exec Approval Needed
  • Manager Approval Needed
  • Exec Escalation

 

We will now go through each of the Switch cases and explain how each one works.

 

Case: Exec Approval Needed

sudosaurus_8-1678271575058.png

 

Action: Update item

 

Next, we are using the ‘Update item’ action to update the ‘Declarations’ list items ‘StartWF’ value with “No”.

 

sudosaurus_44-1678272126352.png


Action:
Start and wait for an approval

 

Next, we use the ‘Start and wait for an approval’ action where we are using one response of ‘Approve’.

This action uses dynamic fields from the both the ‘Get user profile V2’ actions above where we are getting the user profile of the user who submitted their declaration and the Exec Director – this is to enable personalisation in the Approval email that is sent to the Exec Director.

 

sudosaurus_10-1678271597318.png

 

In the settings for this action, we have set the ‘Timeout’ duration to “P29D” – this means that the Approvals action will time out after 29 days (this is a day before Microsoft’s default 30-day timeout).

 

sudosaurus_11-1678271597319.png

 

Next, the workflow is split into a ‘Parallel branch’ – we will start on the left of this branch with ‘Condition 2’.

 

sudosaurus_12-1678271597320.png

 

Action: Condition

 

Next, we are checking that the ‘Outcome’ value from the above ‘Start and wait for an approval’ action is equal to ‘Approve’.

sudosaurus_13-1678271625496.png

 

On the ‘If yes’ branch we start with a new ‘Apply to each’ action where we are using the ‘Responses’ output from the above ‘Start and wait for an approval’ action.

 

sudosaurus_14-1678271625497.png

 

 Action: Update item <Declarations – Update Approval as Yes (1) >

 

Here, we are updating fields on the ‘Declarations’ list (assuming that the Approval status is equal to ‘Approved’).

 

The ‘Approved’ field is set to ‘Yes’.

The ‘Comments’ field is filled with the ‘Responses Comments’ value from the Approval email sent to the Exec Director.

The ‘StartWF’ field is auto-filled with the ‘No’ value.

sudosaurus_45-1678272167702.png

Action: Update item (Set Colleague Data FormStatus value as Exec Approved (1)

 

Finally, we update the ‘FormStatus Value’ on the ‘Colleague Data’ list with “Exec Approved”.

 

sudosaurus_46-1678272197598.png

 

Next, we move over to the right-side of the Approvals parallel branch.

 

Action: Update item (Timeout for Exec Director Approval)

 

Here we are setting the ‘StartWF’ field value to “Yes” and we have configured it to run after ‘Exec Director Approval’ “has timed out” – this will occur after 29 days of approval inactivity.

 

sudosaurus_47-1678272228910.png

 

sudosaurus_18-1678271644494.png

 

Finally, because we have set ‘StartWF’ to “Yes” this this allows the workflow to re-trigger from the top and start the whole process again due to our trigger condition being set to: @not(equals(triggerBody()?['StartWF'],'No')) as detailed at the beginning of this flow. This will keep on lopping through until the Exec Director has approved the declaration item.

  

Case: Manager Approval Needed

 

sudosaurus_19-1678271644494.png

 

Action: Update item (Update item 2)

 

Next, we are using the ‘Update item’ action to update the ‘Declarations’ list items ‘StartWF’ value with “No”.

 

sudosaurus_48-1678272258135.png

 

Action: Start and wait for an approval

Next, we use the ‘Start and wait for an approval’ action where we are using two responses – these are either ‘Approve’ or ‘Escalate to Exec Director’.

This action uses dynamic fields from the both the ‘Get user profile V2’ actions above where we are getting the user profile of the user who submitted their declaration and their manager – this is to enable personalisation in the Approval email that is sent to the user’s manager.

 

sudosaurus_21-1678271667950.png

 

In the settings for this action, we have set the ‘Timeout’ duration to “P29D” – this means that the Approvals action will time out after 29 days (this is a day before Microsoft’s default 30-day timeout).

 

sudosaurus_22-1678271667951.png

 

Next, the workflow is split into a ‘Parallel branch’ – we will start on the left of this branch with ‘Condition’.

 

sudosaurus_23-1678271667951.png

 

Action: Update item (Update item 2)

 

Next, we are using the ‘Update item’ action to update the ‘Declarations’ list items ‘StartWF’ value with “No”.

 

sudosaurus_49-1678272293876.png

 

Action: Start and wait for an approval

Next, we use the ‘Start and wait for an approval’ action where we are using two responses – these are either ‘Approve’ or ‘Escalate to Exec Director’.

This action uses dynamic fields from the both the ‘Get user profile V2’ actions above where we are getting the user profile of the user who submitted their declaration and their manager – this is to enable personalisation in the Approval email that is sent to the user’s manager.

 

sudosaurus_50-1678272363219.png

 

In the settings for this action, we have set the ‘Timeout’ duration to “P29D” – this means that the Approvals action will time out after 29 days (this is a day before Microsoft’s default 30-day timeout).

 

sudosaurus_26-1678271690748.png

 

Next, the workflow is split into a ‘Parallel branch’ – we will start on the left of this branch with ‘Condition’.

 

sudosaurus_27-1678271690748.png

 

We now move to the ‘If no’ branch of ‘Manager approval’.

 

Here, we are updating fields on the ‘Colleague Data’ and ‘Declarations’ lists (assuming that the Approval status is equal to ‘Exec Escalation’).

 

Action: Update item 6

 

Next, we use an ‘Update item’ action to change the ‘FormStatus Value’ field on the ‘Colleague Data’ list to “Exec Escalation”.

 

sudosaurus_51-1678272424139.png

 

Action: Update item 7

 

Next, we use another ‘Update item’ action to set the ‘StartWF’ field on the ‘Declarations’ list to “Yes”.
This will trigger the workflow to start again based on it’s trigger condition and now that the ‘FormStatus Value’ is set to “Exec Escalation” – the next iteration will move to the Switch case of “Exec Escalation”.

This existing / preceding workflow will timeout after 29 Days and no further actions are required.

 

sudosaurus_52-1678272452415.png

 

Next, we move over to the right-side of the Approvals parallel branch.

 

Action: Update item (Timeout for Manager Approval)

 

Here we are setting the ‘StartWF’ field value to “Yes” and we have configured it to run after ‘Manager Approval “has timed out” – this will occur after 29 days of approval inactivity.

 

sudosaurus_53-1678272478027.png

 

Finally, because we have set ‘StartWF’ to “Yes” this this allows the workflow to re-trigger from the top and start the whole process again due to our trigger condition being set to: @not(equals(triggerBody()?['StartWF'],'No')) as detailed at the beginning of this flow. This will keep on lopping through until the Exec Director has approved the declaration item.

 

sudosaurus_31-1678271721723.png

 

Case: Exec Escalation

 

sudosaurus_32-1678271721724.png

 

Action: Update item (Update item 3)

 

Next, we are using the ‘Update item’ action to update the ‘Declarations’ list items ‘StartWF’ value with “No”.

 

sudosaurus_54-1678272504713.png

 

Action: Start and wait for an approval (Exec Escalation Approval)


Next, we use the ‘Start and wait for an approval’ action where we are using one response of ‘Approve’.

Next, we use the ‘Start and wait for an approval’ action where we are using one response of ‘Approve’.

This action uses dynamic fields from the both the ‘Get user profile V2’ actions above where we are getting the user profile of the user who submitted their declaration and the Exec Director – this is to enable personalisation in the Approval email that is sent to the Exec Director.

 

sudosaurus_34-1678271744049.png


Next, the workflow is split into a ‘Parallel branch’ – we will start on the left of this branch with ‘Condition 3’.

 

sudosaurus_35-1678271744050.png

 

Action: Condition

 

Next, we are checking that the ‘Outcome’ value from the above ‘Start and wait for an approval’ action is equal to ‘Approve’.

 

sudosaurus_36-1678271768716.png

 

On the ‘If yes’ branch we start with a new ‘Apply to each’ action where we are using the ‘Responses’ output from the above ‘Start and wait for an approval’ action.

 

sudosaurus_37-1678271768717.png

 

Action: Update item <Declarations – Update Approved as Yes (3) >

 

Here, we are updating fields on the ‘Declarations’ list (assuming that the Approval status is equal to ‘Approved’).

 

The ‘Approved’ field is set to ‘Yes’.

The ‘Comments’ field is filled with the ‘Responses Comments’ value from the Approval email sent to the Exec Director.

The ‘StartWF’ field is auto filled with the ‘No’ value.

 

sudosaurus_55-1678272549707.png

 

Action: Update item <Set Colleague Data FormStatus value as Exec Approved (2)>

 

Finally, we update the ‘FormStatus Value’ on the ‘Colleague Data’ list with “Exec Approved”.

 

sudosaurus_56-1678272583744.png

 

Next, we move over to the right-side of the Approvals parallel branch.

 

Action: Update item (Timeout for Exec Director Escalation)

 

Here we are setting the ‘StartWF’ field value to “Yes” and we have configured it to run after ‘Exec Director Escalation’ “has timed out” – this will occur after 29 days of approval inactivity.

 

sudosaurus_57-1678272611500.png

 

sudosaurus_41-1678271768723.png

 

Finally, because we have set ‘StartWF’ to “Yes” this this allows the workflow to re-trigger from the top and start the whole process again due to our trigger condition being set to: @not(equals(triggerBody()?['StartWF'],'No')) as detailed at the beginning of this flow. This will keep on lopping through until the Exec Director has approved the declaration item.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492