web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to write my Update...
Power Automate
Answered

How to write my Update item

(0) ShareShare
ReportReport
Posted on by 517
 
Hi All,
 
I want to change the status of all items to inactive as soon as the last date is due in SharePoint.
 
How can I achieve this?
 
dKayt
Categories:
  • Suggested answer
    Korhanh Profile Picture
    20 on at

    Hello dKayt,

    To solve this issue in SharePoint, you can use Power Automate to create a flow that automatically changes the status of all items to "inactive" once the last date is due.

    1. Schedule the Flow: Set the flow to run daily (or at your preferred frequency).

    2. Retrieve Items: Fetch all items from the SharePoint list.

    3. Loop Through Each Item:

      • Use the Apply to Each action to iterate through the retrieved items.
    4. Compose Condition:

      • Implement the following expression to check the date:
      if( less( formatDateTime(items('Apply_to_each')['Date'], 'yyyy-MM-dd'), formatDateTime(utcNow(), 'yyyy-MM-dd') ), 'true', 'false' )

      This checks if the item's date is earlier than the current date.

    5. Condition Check:

      • If the result of the compose condition is true, change the item's status to "Inactive."
    6. Update Item:

      • Update the item's status to "Inactive" if the condition is met.
     
     
     
     
     
  • CU18061035-1 Profile Picture
    18 Microsoft Employee on at
    hey
     
    you would need to use Power Automate for it with a recurrence trigger set to daily who checks the dates and if a date is passed update the item and set the status to inactive.
     
     
    if my reply helped please mark as verified answer,
     
     
    cheers
  • dkayt Profile Picture
    517 on at
    Hi, 
     
    thanks for replying.
    Let me show you how my flow actually looks like:
    The trigger works, but I don't know how to change the Status (active -> inactive) of all CustomerID with the same ID at the same time when the last Date is due.
    Do you have any idea?
     
    Regards, dKayt
  • dkayt Profile Picture
    517 on at
    Hi Korhanh,
     
    thanks for replying.
    I think I need to be more specific: as long as any date from the CustomerID has not yet passed, the status remains ‘active’ as soon as the recent date is ‘due’, which sets all statuses to ‘inactive’ at the same time. 
    Do you have a suggestion?
     
    Regards, dKayt
  • Verified answer
    Korhanh Profile Picture
    20 on at
    Hello

    I created and tested a workflow, and I recommend working with data that has a specific CustomerID.

    1. Data Retrieval: First, I used the Get Items action to retrieve data with CustomerID 566.

    2. Variable Initialization: Next, I added an "Initialize variable" step and defined this variable as an array.

    3. Date Formatting: In the "Apply to each" step, I extracted the relevant dates using formatDateTime(items('Apply_to_each')?['Date']).

    4. Identifying the Last Date: I added a Compose action, naming it "LastDate," to capture the most recent date using the expression formatDateTime(last(sort(variables('SortedDates'))), 'MM/dd/yyyy').

    5. Checking Today's Date: I added another Compose action named "CheckDateToday." In this step, I used the expression if(less(formatDateTime(outputs('LastDate'), 'yyyy-MM-dd'), formatDateTime(utcNow(), 'yyyy-MM-dd')), 'true', 'false') to check if today's date is less than or equal to LastDate.

    6. Adding a Condition: Finally, I included a Condition action that executes the necessary adjustments if the result of "CheckDateToday" is true.

    By following these steps, you can create an effective workflow that processes data within a specific date range. I believe this approach can be useful in your own applications as well.

     
     
     
     
     
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 292 Super User 2026 Season 2

#2
Henil Profile Picture

Henil 128

#3
anirudhev Profile Picture

anirudhev 124

Last 30 days Overall leaderboard