To mark checkbox to true depending on valid to date.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 11:57 AM
Hi Peeps,
I have active field -checkbox- on cmn_cost_center table. Now I want to make checkbox to true depending on valid to date. For that reason I created the below BR
Name : Set active to True
AFTER - Insert, Update.
(function executeRule(current, previous /*null when async*/) {
// Get the "valid to" and current date
var validToDate = new GlideDateTime(current.valid_to);
var currentDate = new GlideDateTime();
// Check if "valid to" date is in the future
if (validToDate > currentDate) {
// Set the "active" field to true
current.active = true;
}
})(current, previous);
I have 2 questions here
1) do I need to create any conditions on this BR.
2) do I need to create a fix script to mark the existing cost centers active??
can anyone give me the best practice here
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 02:27 PM
Will this work?
valid_toRELATIVEGT@minute@ahead@0