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

Community site session details

Session Id :
Power Automate - General Discussion
Answered

How to write my Update item

(0) ShareShare
ReportReport
Posted on by 483
 
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:
I have the same question (0)
  • Suggested answer
    Korhanh Profile Picture
    20 on at
    How to write my Update item

    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.
     
     
     
     
     
  • mmbr1606 Profile Picture
    14,353 Super User 2025 Season 2 on at
    How to write my Update item
    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
    483 on at
    How to write my Update item
    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
    483 on at
    How to write my Update item
    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
    How to write my Update item
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 655 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 371 Moderator

#3
chiaraalina Profile Picture

chiaraalina 276

Last 30 days Overall leaderboard