Flow Designer: reference the Current Date in an IF condition

Michael H
Giga Guru

Hi SN Community, 

I have a requirement in the Flow Designer to trigger an IF condition if the date on a record is "on or before the current date".

The flow designer only appears to accept a 'data pill' field as an input.

find_real_file.png

Is there a way to insert the current date as the comparison without referencing a record field?

If not, is it possible for the ServiceNow add this to the requested functionality list?

Cheers,

- Mike

1 ACCEPTED SOLUTION

Michael H
Giga Guru

Update 1.0:

I was able to work-around this by creating a custom 'action' which uses a small script to return the current date.

(function execute(inputs, outputs) {
  
  //Output the current date (glide_date)
  outputs.result = new GlideDate();
  
})(inputs, outputs);

find_real_file.png

The returned current date from the script can be used a 'data pill' to compare dates.

find_real_file.png

View solution in original post

6 REPLIES 6

Hi Joshua,

In our case it's not reevaluated within the Flow. Instead the updated field (Account Start Date) is reevaluated separately each morning by a Scheduled Job on the record itself.

The reason for the IF comparison in this Flow is to check if the account needs to be started immediately or can be checked on a later date. 

 

If you're looking to do similar using a flow, you might be able to use something like a "do the following until" flow logic, but I wouldn't recommend having too many transient flows running if it can be done using a different method.

Cheers, Michael

This is very helpful! Was wondering if you could share how you have your action configured!