cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

AddDays expression

What do I need to type in this expression to get the Due Date to be Start Date (which is a field from a Form) + x days.

AddDays-forum post.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

 

Please refer to screenshot below to create the flow:

1.png

 

The expression for the Due Date Time field as below:

add(outputs('Compose'),2)

 

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
fchopo
Super User
Super User

Hello @Anonymous 

For example, to add 2 days to the start time field, you could use an expression like:

addDays(body('USB_Drive_()')?['Start_Date'];2)

 

Hope it helps.

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Anonymous
Not applicable

Thanks, I don't think that's quite what I need. The field that will have the calculated date is the Due Date" and the date it shows needs to be "Startdate" field from the form + 5 days (for example).

 

e.g. the form Start Date is Feb 20th. So Due Date field should be Feb 20th+5 days = 25th (but the Start Date is not manually entered it comes from the Form Field).  

So, if I understand, you need the start date field from the form response, isn't it? Therefore the expression should be:

addDays(body('get_response_details)?['StartDate'];5)

Hope it helps.

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Anonymous
Not applicable

I got this error..

 
"error": {
"code": "",
"message": "The request is invalid:\r\nCannot convert the literal 'addDays(body('get_response_details)?['2020-02-12'];5)' to the expected type 'Edm.DateTimeOffset'.",
"innerError": {
"request-id": "8a1ca5c4-8ebe-4044-ab10-70eb12be8cd9",
"date": "2020-02-11T19:36:35"
}
}
}
flow error-b-2-11.JPG
Flow error 2-11.JPG

Hello @Anonymous 

You should use formatDateTime function to convert date value to string, as it is expected to create the task in Planner. Have a look at this sample (visit_date is a date field in the form):

Date_Flow.png

 

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Anonymous
Not applicable

Thanks...where would the AddDays expression be placed in this?

Hi @Anonymous ,

 

Please refer to screenshot below to create the flow:

1.png

 

The expression for the Due Date Time field as below:

add(outputs('Compose'),2)

 

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous 

I don't understand your question... Anyway, you could place the formula inside the "Due Date" field in planner task.

 

 

 

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,847)