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.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (3,237)