cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Darren137227
Helper I
Helper I

Trigger flow with format date time expression

Hi, I am trying to trigger a flow comparing the SP modified field against another date time field called CUOSignOffDt.

I only want to compare down to format dd/MM/yyyy hh:mm format.

 

I have managed to successfully add a condition at the beginning of the workflow comparing the two fields using the format date time expression and this works fine. However, ideally I don't want the flow to trigger, so need to do the comparison in the 'When an item is created or modified' trigger action as a Conditional trigger. To note the 'When an item is created or modified' trigger action is using a gateway connection to an on prem version of SP so can't use the 'Get changes for an item or a file action'

I need to compare the two date time fields, making sure they are the same down to dd/MM/yyyyy hh:mm format in a trigger condition in the 'When an item is created or modified' trigger action. 
I tried various syntax options, along the lines of, but saying incorrect syntax:

@

@equals(triggerBody()?formatDateTime(['Modified'], 'dd/MM/yyyy hh:mm')?['value'],formatDateTime(['CUOSignDt'], 'dd/MM/yyyy hh:mm'))

 

Any help would be highly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @Darren137227,

 

Can you try and use this expression:

@equals(formatdatetime(triggerOutputs()?['body/Modified'], 'dd/MM/yyyy hh:mm'), formatdatetime(triggerOutputs()?['body/CUOSignOffDt'], 'dd/MM/yyyy hh:mm'))

View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @Darren137227,

 

Can you try and use this expression:

@equals(formatdatetime(triggerOutputs()?['body/Modified'], 'dd/MM/yyyy hh:mm'), formatdatetime(triggerOutputs()?['body/CUOSignOffDt'], 'dd/MM/yyyy hh:mm'))

View solution in original post

Hi Expiscornovus,

the syntax was successfully accepted but got this message when triggered....

 

Darren137227_0-1620902460798.png

 

The template language function 'formatdatetime' expects its first parameter to be of type string. The provided value is of type 'Null'



Expiscornovus
Super User
Super User

Hi @Darren137227,

 

Is the CUOSignOffDt field by any chance empty in that test?

Hi Expiscornovus , it wasn't empty, it was me supplying the wrong name, it's actually called 'CUOSignDt' -  doh!

Works a treat!! Thanks a million.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Users online (1,988)