Flow Designer - Wait Relative Duration

matt_a
Kilo Guru

Using Flow designer, I am wanting to add logic that waits for a date contained in a variable.

However, I want it to wait for a specific time on that date: 23:00:00

How would I achieve this? If I use wait for, it will wait for the set time after the flow was initiated on the date passed into the Flow. 

find_real_file.png

Many thanks

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you need to use custom action and pass the date variable value

then in that return the date/time

see here

Flow Designer: reference the Current Date in an IF condition

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you need to use custom action and pass the date variable value

then in that return the date/time

see here

Flow Designer: reference the Current Date in an IF condition

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thanks @Ankur Bawiskar 

I have written the script:

(function execute(inputs, outputs) {
var gdt = inputs.endDate;
var atSix = gdt.toString().slice(0,10) + " 18:00:00";
var gdt = new GlideDateTime(atSix);

  outputs.enddatetime = gdt;
  
})(inputs, outputs);

But this is returning the following in the output:

find_real_file.png

Would you be point out whats wrong with my script and why its returning 00:00:00?

Hi,

try this

(function execute(inputs, outputs) {
	
	var date = inputs.endDate;
	var gdt = new GlideDateTime(date + ' 23:00:00');
	outputs.enddatetime = gdt;

})(inputs, outputs);

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader