Skip to main content

Notifications

Power Automate - General Discussion
Answered

Changing a Status Field Older than 30 Days

(0) ShareShare
ReportReport
Posted on by 79
Hello, 
 
I have a Power Apps Gallery that is connected to a SharePoint list. In this list, I have a status column for Order, Restock, Arrived, Contact, Back Order etc. 
 
I need to update the status column to "Restock", based on records that are 30 days only if in "Arrived" Status. Below is what I have but changes all records with "Arrived" status to "Restock". The list has the date as month day year but everything seen online thus far is year date month. So initially, I thought it was working but not the case.
 
 
Thoughts or ideas?
 
Categories:
  • Verified answer
    Tasturhelden24 Profile Picture
    Tasturhelden24 79 on at
    Changing a Status Field Older than 30 Days
    What ended up working for me was the utilizing the "Get past time".
     
  • David_MA Profile Picture
    David_MA 9,039 on at
    Changing a Status Field Older than 30 Days
    Based on your last screen shot, it is most likely not working because your condition is not set up how I suggested. The right side of the date check should be true. True needs to be entered from the expression builder and not typed into the condition. See my original post below.
     
    If the expression on the left is set up correctly, that will return either true or false. On the right, you are sending it a date so true or false is never going to be equal to a date.
  • Tasturhelden24 Profile Picture
    Tasturhelden24 79 on at
    Changing a Status Field Older than 30 Days
    Feel like I am almost there. It runs all the way through but does not update anything. 
     
     
     
     
     
  • David_MA Profile Picture
    David_MA 9,039 on at
    Changing a Status Field Older than 30 Days
    You need to put the Compose action inside the Apply to each action. You will see that it returns something different from there and this is what you will use in your expression. Although now that I have a screen shot of what you are doing, I believe this is the expression you need: greaterOrEquals(item()?['DatePartsOrdered'],addDays(utcNow(),-30))
  • Tasturhelden24 Profile Picture
    Tasturhelden24 79 on at
    Changing a Status Field Older than 30 Days
    David_MA I attempted to follow your suggestion but seem to be stumbling still. Given the screen shot below am I way off track?
     
  • David_MA Profile Picture
    David_MA 9,039 on at
    Changing a Status Field Older than 30 Days
    I believe your expression is not valid: greaterOrEquals(outputs('Get_items')?['body/value'],addDays(utcNow(),-30)). You need to insert the highlighted portion from the dynamic content picker. Although, based on the error message, this action is within an apply to each. That makes it trickier to put this into an expression.
     
    To get this value for the expression, add a Compose action to your flow and insert the field for the expression into it from the dynamic content picker. Then click on the three-dot menu and choose Peek Code (old designer) or Code view (new designer). In the new designer you'll see something like this:
     
    {
      "type": "Compose",
      "inputs": "@item()?['Modified']"
    }
     
    Use the highlighted portion above in your expression. Of course, "Modified" will be replaced by the internal name of the field you choose.
  • Tasturhelden24 Profile Picture
    Tasturhelden24 79 on at
    Changing a Status Field Older than 30 Days
    Attempted the following with three records set to "Arrived": 
     
    greaterOrEquals(outputs('Get_items')?['body/value'],addDays(utcNow(),-30))
     
    Gets a "Condition" failed. 
     
     
     
    Does the Body/Value need to be the name of the SharePoint list column? 
  • David_MA Profile Picture
    David_MA 9,039 on at
    Changing a Status Field Older than 30 Days
    Filters and conditions with dates in Power Automate must use the ISO8601 date format, which is yyyy-MM-dd. However, looking at your expression, the second condition is never going to return true. How would the current date ever be greater than adding 30 days to the current date. For example, today is October 16, 2024. If you add 30 days to that, it will be November 15, 2024. October 16 is not greater than November 15 :-)

    I would change your approach in the condition to use this approach for the second condition:


    The expression on the left is greaterOrEquals(outputs('Get_item')?['body/Created'],addDays(utcNow(),-90)). This is looking for items where the item was created within the past 90 days.

    This is what is returned so you can see that the expression returns dates using the ISO8601 format:

    Based on what I have shown, you should be able to figure out a condition that meets your requirements.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,636

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,942

Leaderboard