cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
earlbrian
Helper II
Helper II

Flow Date Condition

Hi!

 

I created a flow condition where if date today is equal to 'Review End Date and Time' it will trigger a notification where the recipient will have the option to choose on when to complete the revision of the document.

 

Here is the conditional flow:

 

Screen Shot 2021-02-07 at 9.59.35 AM.png

 

Condition is 

 

utcNow('MM-dd-yyyyTHH:mm tt')

 

 is equal to Review End Date and Time (mm/DD/yyyy hh:mm AM/PM format). However this doesn't trigger any notification when I did a test.

 

Before I did my test, I changed the Review Date and Time to today's date and changed the time to I can track if the test works. On checking it showed Expression result is 'false"

8 REPLIES 8
Hardesh15
Super User II
Super User II

@earlbrian  String inside utc() is not in exact format as in your date column. Make sure that both return same time format. 

Please try this 

utcNow('MM/dd/yyyy') is equal to formatdatetime(' Review End Date and time','MM/dd/yyyy')

Change review end date and time with your dynamic column name.

Please 'Thumbs Up' the posts that helped you and 'Mark as Solution' if my post answered your question.

@Hardesh

Hi @Hardesh15 when using the suggestion it shows expression is invalid when adding equal to which is 

formatdatetime('outputs('Get_file_properties')?['body/ReviewEndDateandTime']','MM/dd/yyyy') 

 

 

Hello @earlbrian ,

remove the apostrophes around the outputs('Get_file_properties')?['body/ReviewEndDateandTime'] dynamic content. Apostrophes are needed only if you define a specific value, if you're using dynamic content you don't need apostrophes in the expression.

formatDateTime(outputs('Get_file_properties')?['body/ReviewEndDateandTime'],'MM/dd/yyyy') 

 



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

[ I also blog about Power Automate solutions even for non-IT people. ]

Hi @tom_riha I followed your suggestion and got the error below

 

Unable to process template language expressions for action 'Condition' at line '1' and column '24287': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.

 

@earlbrian  please check your return date is null or not. If it is null use this expression then,

formatDateTime(if(empty(outputs('Get_file_properties')?['body/ReviewEndDateandTime']),Null,outputs('Get_file_properties')?['body/ReviewEndDateandTime'],'MM/dd/yyyy'))

Please 'Thumbs Up' the posts that helped you and 'Mark as Solution' if my post answered your question.

@Hardesh

@Hardesh15 used that expression and got an error

 

Unable to process template language expressions for action 'Condition' at line '1' and column '18114': 'The template language function 'if' expects three parameter: the condition to test as the first parameter, the value to return if the condition is true as the second parameter, and the value to return if the condition is false as the third parameter. The function was invoked with '4' parameter(s). Please see https://aka.ms/logicexpressions#if for usage details.'.

 

These are the expressions used 

utcNow('MM/dd/yyyy')
 
equal to 
 
formatDateTime(if(empty(outputs('Get_file_properties')?['body/ReviewEndDateandTime']),Null,outputs('Get_file_properties')?['body/ReviewEndDateandTime'],'MM/dd/yyyy'))

@earlbrian  See expression- in last two brackets are creating problem. It is typo from my side.

formatDateTime(if(empty(outputs('Get_file_properties')?['body/ReviewEndDateandTime']),Null,outputs('Get_file_properties')?['body/ReviewEndDateandTime']),'MM/dd/yyyy')

Please 'Thumbs Up' the posts that helped you and 'Mark as Solution' if my post answered your question.

@Hardesh

 

@Hardesh15 sorry for the late response. IT showed an error. I have another question related to that.

 

2/14/2021 8:44 PM
 
How do I format this in utcNow? Is this correct utcNow('MM/dd/yyyy Th:mm tt’)?
 
Also if my column has the same format for date and time example 2/14/2021 8:44 PM. Would it be possible to just add the dynamic content? The REDT Helper column value is a calculation based on other column (calculated column) with the formula =IF(ISBLANK([Review End Date and Time]),"",[Review End Date and Time]+1)
 
Screen Shot 2021-02-15 at 12.47.27 PM.png
 
In addition, I'm confused with this date and time formatting.
 
Where do we reference the format is it on the SP column or the value in the backend? The column I created for Review End Date and Time is m/dd/yyyy h:mm AM/PM (2/15/2021 9:15 PM) while the backend shows (2021-02-15T17:15:00Z).
 
 
 

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Users online (29,010)