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 / AddDays Dynamic days a...
Power Automate
Answered

AddDays Dynamic days according to sharepoint list column, possible?

(0) ShareShare
ReportReport
Posted on by 45

So I have my flow below to automatic send a reminder 30 days out date:

 

ferby2023_0-1708364529647.png

 

I am using the formula addDays(utcNow(),30,'MM/dd/yyyy') to the variable.

 

But now, i want to change this number '30' to my 'Days to Notify' Sharepoint List column. In this column, people will type different number of days.

I tried several things but none of them worked. Any suggestion?

Many thanks!

Categories:
I have the same question (0)
  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    @ferby2023 

    1) Ask users to save their notification preference in the 'Days to Notify' column within the SharePoint List.

    2) Utilize the 'Get items' action in Power Automate with a Filter clause to retrieve the 'Days to Notify' column from the SharePoint List. Ensure to store this value as an integer variable.

    3) Use the retrieved integer variable directly in the 'addDays' function alongside 'utcNow()' to calculate the date for notification. For instance:

    addDays(utcNow(), variables('Days to Notify'), 'MM/dd/yyyy')
  • ferby2023 Profile Picture
    45 on at

    Thanks for helping!

    Unfortunately, I tried this before and did not work, this is the issue message:

     'The variable action 'Initialize_variable' of type 'InitializeVariable' cannot be nested in an action of type 'For_each'.'.

     

    ferby2023_0-1708374861930.png

     

  • Verified answer
    SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    The 'Initialize variable' action can't be used inside loops. It should be placed at the beginning of the flow, typically right after the trigger. This action initializes variables and should remain empty. 

     Instead, use the 'Set variable' action within the loop to modify the variable's value as needed.

  • Verified answer
    SamLed Profile Picture
    2,340 Moderator on at

    Hi @ferby2023,

     

    I have a slightly different approach using a calculated column to determine the notification date. The formula for this column is different depending on the need:

    • If you want to notify for items based on status (ex: not completed), formula will be "=[created]+[Days To Notify]"
    • If you want to notify for items based on a due date, formula will be "=[Due Date]-[Days To Notify]"

    Once done, I fetch items using "Get items" but as I can't filter on NotifyDate, because OData filter do not accept calculated column, I filter on status or on Due date greater or equals utcNow().

     

    Next I use a filter action to filter on NotifyDate and finally work on only items that has NotifyDate equals to utcNow():

     

    SamLed_1-1708376974152.png

    filter condition expressions:

    • Left: formatDateTime(item()['NotifyDate'], 'yyyy-MM-dd')
    • Right: formatDateTime(utcNow(), 'yyyy-MM-dd')

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

      

  • ferby2023 Profile Picture
    45 on at

    @SudeepGhatakNZ  @SamLed  thanks for helping! both seems to work now. Thank so much for helping guys! 🙂

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 482

#2
11manish Profile Picture

11manish 280

#3
David_MA Profile Picture

David_MA 268 Super User 2026 Season 1

Last 30 days Overall leaderboard