cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
flowArcade
Regular Visitor

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
Super User
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.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

2 REPLIES 2
Expiscornovus
Super User
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.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Thank you so much! It works fine now 😊

Helpful resources

Top Solution Authors
Users online (2,952)