cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tee_Latte
Regular Visitor

My Expression gets error, formatDateTime and addDays

Hi Everyone,

Need suggestion, as i got an error of my expression about the formatDateTime and addDays.

I compose with "addDays"  

 

"@addDay(item()?['Training_x0020_Date'],+1)"

Tee_Latte_0-1599745303491.png

 

 

 

['Training_x0020_Date'] is a filed in sharepoint list, this field was set to be "Date and Time".

 
 

Annotation 2020-09-10 205904.pngAnnotation 2020-09-10 205905.png

 

 

 
 

When running the flow, it gets error at this step of compose 

"Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '18549': 'The template language function 'addDays' expects its first parameter to be a string that contains the time. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#adddays for usage details.'."

 

Please give an advice.

Thanks in advance.

 
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Tee_Latte 

 

Since you're using Get items, this will return all the items and create an array. Are you expecting more than 1 item from get items?

 

If so, you will need to put everything inside a Apply to each loop.

 

If you're expecting 1 value by using a filter on your Get items, than you can use this expression:

addDays(first(outputs('Get_items')?['body/value'])?['Training_x0020_Date'],1)

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

4 REPLIES 4
Jcook
Super User III
Super User III

Hello @Tee_Latte 

 

Could you share a screenshot of your full flow. Is your action inside a Apply to each loop?


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Hi Jcook,

 

This is my full flow during construction. Not yet complete.

The compose section is not under the loop.

 

Tee_Latte_0-1599747449590.png

Thank so much.

Hi @Tee_Latte 

 

Since you're using Get items, this will return all the items and create an array. Are you expecting more than 1 item from get items?

 

If so, you will need to put everything inside a Apply to each loop.

 

If you're expecting 1 value by using a filter on your Get items, than you can use this expression:

addDays(first(outputs('Get_items')?['body/value'])?['Training_x0020_Date'],1)

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

Hi Jcook,

 

Thanks for your advice, after try to put in the loop (apply to each), it works.

Thank again. 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,408)