In this post, you will learn to update a SharePoint column status based on the date.
If the date field is set within the next 10 days, it will set the status as upcoming
If the date field is set for a date less than today it will set the status as past
If the date is set after one month it will set the status as future
I have created a SharePoint List With the below columns and data type
Column Name | Data Type | Value |
ProductName | Single line of text | |
Price | Number | |
Currency | Currency | INR, USD, CAD |
IsProductInStock | Choice | Yes, No |
ProductDeliveryDate | Date and time | |
Status | Choice | Upcoming, Past, InFuture |
Click On Scheduled cloud flow. Name the flow.
Select the starting date and time and schedule it to repeat every day and click on Create.
Click on New step and select initialize the variable. Parallelly Initialize three variables and Rename the variables.
My variable names and its values are as shown below with their type as string
varUpcoming
addDays(utcNow(),10,'MM/dd/yyyy')
varInFuture
addDays(utcNow(), 30, 'MM/dd/yyyy')
varPast
utcNow()
To filter the data based on date click on Add action and select Get items parallely.
Add below code in respective get items filter query
Get items
ProductDeliveryDate ge '@{utcNow()}' and ProductDeliveryDate le '@{variables('varUpcoming')}'
Get items 2
ProductDeliveryDate ge'@{variables('varInFuture')}'
Get item 3
ProductDeliveryDate le'@{variables('varPastDate')}'
To update the data into SharePoint list, update the status column with respective values.
If you liked the post, please share it with others 🙂
Please feel free to comment if you are stuck in any step
Thank you for reading 🙂