How to check date is greater than 24 hours in flow desinger from catalog variable

Kishor O
Tera Sage

I have one variable in catalog form named " change start date".

How I can check whether the change start date is greater than 24 hours in flow designer and based on that I need to create a Normal or emergency change record?

4 REPLIES 4

Pratiksha
Mega Sage
Mega Sage

What is the use case? In flow you can create trigger for the particular request which will trigger after 24 hours. Explain what you are trying to do with it. 

KishorO_0-1716788941931.png

@Pratiksha  Here in above image if Enter date for Change Record  Variable date time is less than 24 hours from now I need to create emergency change record else if more than 24 hours from now I need to create normal change record using flow designer.

@Kishor O 

You can add a flow variable with the limit date you want to have (24hrs in this case).

Add 1 Set Flow Variable to set the date 24hrs from now:

HayoLubbers_3-1716794703050.png

 

var gdt = new GlideDateTime();
gdt.add(86400000); //Add 24hrs
return gdt;

 

And then you can compare your date with the emergencyDateLimit.

 

In the below example, the check is if the date is before the emergencyDateLimit. If true, emergency change else, your normal change.

HayoLubbers_1-1716794598379.png

 

And for the 30th of May

HayoLubbers_2-1716794640047.png

 

 

dgarad
Giga Sage

Hi @Kishor O 

you need to create custom action for that

1) pass both start and end

2) in that custom action; have a script and check if the difference is more than 24

3) have output variable of type string

4) then use this custom action and use IF action to check if the diff is more than 24

Custom Action in ServiceNow Flow Designer

If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.

Thanks
dgarad