How to check date is greater than 24 hours in flow desinger from catalog variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2024 10:23 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2024 10:46 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2024 10:51 PM
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2024 12:24 AM - edited ‎05-27-2024 12:25 AM
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:
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.
And for the 30th of May
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2024 11:38 PM
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
Thanks
dgarad