cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
flowArcade
New Member

Comparing a Form-Date with current Date in a if-condition

Hello,

 

i am new to flow and want to compare a date from a input of a Forms-Document with the current date

 

To get the current date i used this function: 

formatDateTime(triggerBody()?['createdon'], 'yyyy-MM-dd')
 
flowArcade_0-1642578850671.png

if-else condition: when the Forms-Date is equal to the current date OR the approvals are all 'approved', than...

 
Probably one of these Date Formats are wrong so its not possible to compare but i didnt know how to fix it.
 
This is the error when the flow is starting:
flowArcade_2-1642579151957.png

English: Unable to process template language expressions for action "condition" in row "1" and column "37392": The template language function "formatDateTime" expects a parameter of type "string" as first parameter. The specified value is of type "Null".


 

Best Regards and thank you!
J.
1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Dual Super User
Dual Super User

Hi @flowArcade,

 

You are using the When a response is submitted trigger action, correct? I don't think that action has a createdon field in the body. I do see the eventTime which is a datetime field.

 

Can you try that field instead:

formatDateTime(triggerBody()?['eventTime'], 'yyyy-MM-dd')

 

You might also want to check the formatting on the Bis wann field in the left side of the condition. Maybe you need to apply formatting to that field to in order to match the same yyyy-MM-dd format.

View solution in original post

2 REPLIES 2
Expiscornovus
Dual Super User
Dual Super User

Hi @flowArcade,

 

You are using the When a response is submitted trigger action, correct? I don't think that action has a createdon field in the body. I do see the eventTime which is a datetime field.

 

Can you try that field instead:

formatDateTime(triggerBody()?['eventTime'], 'yyyy-MM-dd')

 

You might also want to check the formatting on the Bis wann field in the left side of the condition. Maybe you need to apply formatting to that field to in order to match the same yyyy-MM-dd format.

Thank you so much! It works fine now 😊

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (3,141)