cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lbell
Level: Powered On

Create Task by Subtracting From Future Date

I'm creating a list pulled from a form. One of the fields is a future date, before which certain items need to be accomplished. From that date, I'd like to create different tasks for the team. This specific task needs to be completed 14 days prior to the end date. 

 

The only expression I'm seeing is "subtractfromTime", but am having trouble understanding how to organize that expression in order for the flow to work.  

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Create Task by Subtracting From Future Date

Hi @lbell 

 

The silly mistake due to which you are getting those vague values for month is you are using mm (which denotes minutes) you should use MM (which denotes month). 

 

Hope this Helps!

View solution in original post

4 REPLIES 4
Dual Super User
Dual Super User

Re: Create Task by Subtracting From Future Date

Hi @lbell 

 

Can you please share more details on this?

 

In case you want to subtract 14 days from a variable "x", you can use the expression

addDays(variables('x'),-14)
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!
lbell
Level: Powered On

Re: Create Task by Subtracting From Future Date

Just tried this a different way... sorry for the lack of detail. This should have more info.

 

I'm creating a flow starting with the Schedule, Recurrence once every day. I'm pulling dates from a Sharepoint list, but the error is in the Filter Query. This is what I put in the field, trying to set up a reminder for a contract renewal 5 weeks (35 days) prior to expiration. 

 

formatDateTime(addDays(utcNow(),-35),'yyyy-mm-dd')
 
This is the error message I receive: 
 
"status": 400,
"message": "The expression \"PotentialStartDate eq ''2019-49-17\" is not valid.\r\nclientRequestId: 45524fa9-d94a-4cc1-90c9-6ad2b3fc050c\r\nserviceRequestId: 45524fa9-d94a-4cc1-90c9-6ad2b3fc050c"
}
 
No idea why it has "49" as the month. The 17th could be 35 days prior to today? But the month would just be "5", if that were the case. I'm looking to pull contract dates that are 35 days in the future, so the reps can be reminded to finalize in accordance with our deadlines.
 
Afraid I shouldn't have been using the "-" in front of the 35 (if the 17th is 35 days behind today, I'd want to pull a date 35 days in the future? Maybe?), I gave that a try.
 
This is the error message I receive when I use this string:   formatDateTime(addDays(utcNow(),35),'yyyy-mm-dd') 
(Removed the "-" from in front of the 35.)
 
"status": 400,
"message": "The expression \"PotentialStartDate eq ''2019-54-26\" is not valid.\r\nclientRequestId: 612a2c10-e71c-4b8a-a1f8-45563eb3dc8f\r\nserviceRequestId: 612a2c10-e71c-4b8a-a1f8-45563eb3dc8f"
}
 
Now they're looking for the 54th month? I'm beyond confused. Followed every detail of a YouTube video from a gentleman who it seemed to work for, so I have no idea what I'm doing incorrectly. I'm definitely not a professional, and know nothing about coding. Honestly (and maybe naively), I didn't think you had to know all of that to use Flow, but I'm coming across a great deal more errors than I had anticipated.
 
I've been working on it all afternoon, so maybe my eyes are missing something obvious. Any help would be greatly appreciated. 
 
Another error I've received (as I've gotten just about every one imaginable):
 
"error": {
"code": 502,
"source": "unitedstates-002.azure-apim.net",
"clientRequestId": "a1c3f169-9e83-40b2-a3cd-c2bba63945cd",
"message": "BadGateway",
"innerError": {
"status": 500,
"message": "String was not recognized as a valid DateTime.\r\nclientRequestId: a1c3f169-9e83-40b2-a3cd-c2bba63945cd\r\nserviceRequestId: a1c3f169-9e83-40b2-a3cd-c2bba63945cd"
}
}
}
Dual Super User
Dual Super User

Re: Create Task by Subtracting From Future Date

Hi @lbell 

 

The silly mistake due to which you are getting those vague values for month is you are using mm (which denotes minutes) you should use MM (which denotes month). 

 

Hope this Helps!

View solution in original post

Community Support Team
Community Support Team

Re: Create Task by Subtracting From Future Date

Hi @lbell ,

 

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply any of @yashag2255 's recommendation to adapt your Flow?

If yes, and you find that solution to be satisfactory, please go ahead and click "Accept as Solution" so that this thread will be marked for other users to easily identify!

 

Best Regards,

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,975)