<= condition for today in BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 01:00 AM
How to write a <= today condition in a BR.
So, last bia approval is a date field. In this BR, i need to check that if last bia approval is not empty and last bia approval is <= today or > today.
Is this the correct way to write this for a date field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 01:03 AM
Hi @Poorva Bhawsar,
please try below script:
(function executeRule(current, previous /*null when async*/) {
// Get the current date
var currentDate = new GlideDateTime();
// Check if the last bia approval field is not empty
if (!current.u_last_bia_approval.nil()) {
// Convert the last bia approval date to GlideDateTime for comparison
var lastBiaApprovalDate = new GlideDateTime(current.u_last_bia_approval);
// Compare dates
if (lastBiaApprovalDate <= currentDate) {
current.setValue('u_bia_state', 'Expired BIA');
} else {
current.setValue('u_bia_state', 'Valid BIA');
}
}
})(current, previous);
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 03:35 AM
So, here is my complete BR, let me know if anything needs to be corrected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 03:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 08:58 PM
But mainly i have 3 conditions:
1. if last bia approval is empty.
2. if last bia approval is not empty and <= today.
3. if last bia approval is not empty and > today.