cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tarjani
Advocate III
Advocate III

Add days to current date field - HELP!

Hi all,

 

When creating an action to Update a field using Common Data Service (Current Environment), I am trying to add 365 days to a date that is in an existing field.  The problem is that when the flow runs, it adds 365 days to the field from today's date, and not the date in the field.

 

Example  - date in field says : 03/03/2020, it should add 365 to that date, not the date it was modified.

The expressions I am using are shown below to assist in clarifying.  

addDays(outputs('Get_Subscription_record_on_Invoice')?['body/ec_currentperiodstart'], 365)

addDays(outputs('Get_Subscription_record_on_Invoice')?['body/vin_enddate'],365)


The above expressions seem to be doing what I would expect from - addDays(utcNow(), 365) - instead of adding on the date that is in the field.

 

Any light would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hi @Tarjani 

 

Can you check if there is data already present in the field in which you want to perform the add days action? You might want to add a compose action and check the run history of the flow to check what date is being returned. 

 

Based on the above, you can add an action to get the record and try again. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

3 REPLIES 3
Tarjani
Advocate III
Advocate III

An extra note to add:

 

If I am to add 365 days in the below scenario it works fine:

 

Field a:  03/03/2020

Field b: This field wants to have a date that is 365 days ahead of field a.

 

In this scenario the expression I have noted above works fine.  The issue is if I want to add 365 days to the same field - in the scenario that would be adding 365 day to field a, so that it becomes 03/03/2021.

yashag2255
Dual Super User II
Dual Super User II

Hi @Tarjani 

 

Can you check if there is data already present in the field in which you want to perform the add days action? You might want to add a compose action and check the run history of the flow to check what date is being returned. 

 

Based on the above, you can add an action to get the record and try again. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Hi @yashag2255 ,

 

I had been looking into the outputs for the flow, but your response made me go check the audit history as well - which showed me my issue.  

 

The expression was updating the field correctly, but there was an update happening in the background changing the date to today's date.  This was unexpected!

Thanks for your feedback, I might not have seen the back ground change otherwise!

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.

Users online (2,164)