cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Harshavardhan22
Frequent Visitor

Creating a flow that sends remainders for Item in a SharePoint list when the status of the Item is in Pending for more than 24 hours

Hello Everyone!!!

I need your help to create flow that sends remainders for Item in a SharePoint list when the status of the Item is in Pending for more than 24 hours. Let me explain you the scenario.....

 

I have created a SharePoint list with multiple columns for approval purpose. Let us say List name is 'Expenses' and columns are Title, Amount, Status and Modified Date. Here Status column is choice column that has 'Waiting for L1 Approval', 'L1Approved', 'L1Rejected', 'Waiting for L2 Approval', 'L2Approved; & L2Rejected as choices. Now when the status is 'Waiting for L1/ L2 Approval' for more than 24 hours based on last modified date, I have to send an remainder email using power automate. 

 

Can you please help me on creating a flow for the process explained above. 

 

Tagging: @Rhiassuring@Heartholme , @Expiscornovus , @Pstork1@eliotcole@codevenkat 

4 REPLIES 4
eliotcole
Super User
Super User

Hi, @Harshavardhan22 , this should hopefully be relatively simple, you just use a combination of the trigger condition of:

@equals(triggerOutputs()?['body/Status']?['Value'], 'Waiting for L1/ L2 Approval')

If your Status field is named slightly differently just be mindful to get it right.

 

The beginning of your flow will then look something like this:

0 - basic flow.jpg

 

The key item being the Get changes for an item or a file (properties only) action, with the following expression in the Since field:

1 - key action.jpg
sub(
    int(
        split(
            triggerOutputs()?['body/{VersionNumber}'],
            '.'
        )[0]
    ),
    1
)

 

Then you just perform a condition on the Changed: Status field from the Get changes for an item or a file (properties only) action, use an expression that consists purely of the word 'true' (lowercase, no quotes) on the other side of the equals, and have a delay for 1 day in the yes side. 👍

 

This will only then fire if the Status field has the desired status, and it will halt if that field hasn't changed from the previous value.

 

After your condition, you can then perform more actions, including (perhaps wise) a check on if the item version number has changed since the version that it triggered with, and if that field has changed since then.

Harshavardhan22
Frequent Visitor

@eliotcole  I am extremely sorry.. I couldn't understand what you are trying to explain as I am very new to power automate...

 

Could you please help me understand where should I use the above mentioned functions. You mean in a scheduled flow or any other?

Like I said, I was editing in the imagery.

 

You should be able to see a clearer idea of what's going on there, now.

 

You will need to use expressions, for this one, but don't be scared of them. Expressions are just like the Flow, but in text.

 

Either way, I'll show you how to do it without them shortly, it'll just be a lot more actions.

OK, and here's a version without any expressions, and I'll tag on that logic I spoke of previously.

 

You *might* have to write one expression, I'll try to give you a value to paste, but it doesn't always work with flow. Either way, it's a really easy expression to put in, and if you make the same Compose actions that I do, you should have no issues with it.

No Expressions ('cept one)

 

SETUP

First up you need to prepare a couple of things, the trigger, and two extra columns in the SharePoint list.

 

Trigger Condition

You need this here to ensure that this flow doesn't run for every single change on the list.

 

Follow these steps to easily create a trigger condition:

1

Add an action

Select a point anywhere in the flow and choose 'Add an action', then 'Data Operation'.

1 - Add an action.jpg
2

Filter array

Select 'Filter array' from the choices.

2 - Filter.jpg
3

Select column

In the left side of the Filter array condition insert a Dynamic Value, and select your desired column.

 

In this example we're choosing 'Status', which is listed as 'Status Value' as it is a choice column on my list.

3 - Pick Column.jpg
4

Enter the condition text

Now in the middle you choose your condition logic, in this case, you wish to ensure that the column is equal to a value that you state, so you choose 'is equal to' here.

 

Then on the right side you want to place the value that you wish the trigger of the flow to fire upon. So here you either type, or copy directly from the list settings the value that you need to match.

4 - Enter text.jpg
5

Edit in advanced mode & Copy Text

Tap 'Edit in advanced mode' and copy or cut all the text from that box using CTRL+A to ensure it's all selected.

5 - Tap 'Edit in advanced mode' and cut all the text.jpg
6

Delete the Filter array

Tap the three dot menu on the Filter array, and select 'Delete'

6 - Delete the Filter array.jpg
7

Go to Trigger Settings

Tap the dot menu on the trigger and select 'Settings'

7 - Tap the dot menu on the trigger and select 'Settings'.jpg
8

Paste Trigger Condition

Look to the bottom of the Trigger Settings you will see the Trigger Condition section.

 

Add a new Trigger Condition and paste the details that you cut from the Filter inside it.

8 - Add a Trigger Condition and paste the details that you cut from the Filter.jpg

 

Congratulations, you have made your first trigger condition!

🏆

 

2 x New Calculated Column in SharePoint List 'versioninteger'

  1. Scroll to the right side of your list
  2. Select 'Add column'
  3. Select 'More...'
  4. You will have the below screen, fill it out exactly as below, and tap 'OK'

Ensure that 'Add to default view' is unticked, as this column does not need to be seen anywhere. Then also ensure that it has the following name, and the formula that is by the side of the image below:

versioninteger

0 - SharePoint Setup.jpg

 

=INT([Version])
previousversioninteger

Repeat the process to add another column, ensure that 'Add to default view' is not ticked, and call it:

previousversioninteger

Place the following formula in the formula box, can you see the slight difference? It has subtracted 1 from the value so the SharePoint list is already providing the previous version number for you!

=INT([Version])-1

 

BUILDING YOUR FLOW

 

Trigger

Your trigger you already know about. You're using the SharePoint list trigger, with the Trigger Condition that you have prepared in advance. (see above)

 

Constants & Changes

The two 'CNST' values are defined once so you can easily use them throughout your flow. Constants are similar to Variables, except a Constant doesn't change (it is constant) and a Variable does (it varies!).

 

These constants use 'Compose' actions, which you can get from the same place as the Filter action that you deleted earlier.

  1. In versionCNST you'll select the SharePoint column that you created in the Prep stage, above, versioninteger. This provides the number that you need in the perfect format.
  2. In previousVersionCNST you will just select the previousversioninteger Dynamic Value and place it in the Input field.
  3. In Get changes for an item or a file (properties only) you simply select the ID from the Trigger, and the output of previousVersionCNST.

1 - Constants and Get changes.jpg

 

Variable

I decided to add some logic in the Yes branch below which needs this, it is a very simple little thing.

 

Just add an Initialize variable action from the Variables connector, which should default to Boolean.

boolean.jpg

Name it itemUpdatedVAR and using the expression builder type in the word 'false' with no quotations around it. Guidance on the expression builder follows.

 

Condition

In the left side of the condition you will want to select the field that you are trying to check for change, in this case mine is called Status, I think yours is the same, so it should look similar.

2 - Condition equation.jpg

In the middle you will need to select 'is equal to' in order to ensure that you are checking that the value in this column matches what you put on the right here.

 

On the right you will need to use the Expression builder, but don't worry, you're just going to type in one word:

2b - Add an expression (Ctrl + S).jpg
true

Condition and Variable.jpg

 

No Branch

Place a terminate action here, you can get this from the Control connector, and then once it's in, use the 'Cancel' option to cancel the flow if it comes to this route.

 

Yes Branch

Here is where you'll place your checking logic.

 

Purely as an example which you can choose to follow (but this is where your path may divert from mine), here is my checking logic.

 

I have used a 'Do until' loop, which will keep delaying by a day, until the ticket is updated.

 

Do until
Do until.jpg

As you can see, this 'Do until' will keep running until the Variable that you created just now reads 'true'. (ignore the undefined, it says that until you run the flow once)

 

So, for each Do until loop this will:

  1. Delay for 1 day.
  2. Then it will check to see if the item has had any changes.
    Here the Since field will use the versionCNST value, which was the version that it came in at. Sooooooooo ...
  3. The condition checks to see if the Since Version Number is equal to the Until Version Number.
    1. Yes - If it is the same, then it will chase the ticket owner to update the ticket.
    2. No - If it has changed it will set the itemUpdatedVAR to true, and the Do until loop will stop.

 

That is the end!

 

You could add further logic, to check how many Do until loops have run, then if it has gone on for a certain amount of days, email the ticket owner's manager to stick a boot up them. 😈

(OK, I'm done now 😅 ... but can you see how much extra needs doing without the expressions? The flip side is that this will be easier for someone else to follow afterwards.)

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,375)