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

SatheeshKumar
Kilo Sage

There is no OOB feature to get current date for now! may be they will add in feature releases.

alternatively you can use Run Start Time (Newyork)

find_real_file.png

 

 

Hi Satheesh,

Thanks, I did think about that as another work-around, but I was unsure about the glideDateTime to glideDate comparison. For all intents and purposes I think this should still work.

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

Does this get reevaluated? Trying to wait for a certain date or time to be reached.