cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Darren137227
Resolver I
Resolver 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'))

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
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,580)