How to do 'Greater than or equal to' comparison between two Date type of fields?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2017 10:01 PM
Hi Friends,
In a workflow I need to add a notification when End Date >= (Now Date + 7 Days) . Basically, if 1 week has passed and no action has been taken then I need to add a notification to approvals to take action. I am able to add the 7 Days to now date by using following code:
var gdt = new GlideDateTime();
gdt.addDays(-7);
var gdt2 = gdt.getDate();
gs.print(gdt2);
Now I do not know how to compare (Greater than or equal to >=) this date with End date. Any suggestions?
Thanks,
KUMAR

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 12:09 AM
Have you tried using the normal > and < operators with the dates? That should work as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 04:34 AM
Hey Ashwani,
You can use ->
end date >= gs.nowDate() + gs.daysAgo(-7)
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2017 04:41 AM
Hey Ashwani,
There is one mistake in your code:
var gdt = new GlideDateTime();
gdt.addDays(7); // here you need to add positive days
var gdt2 = gdt.getDate();
gs.print(gdt2);
now you can use your operators:)
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra