
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 06:30 AM
Hi,
I've a requirement that Decom Date on Database CI should automatically update in list view once the CI status change to Disposed.
I've a below Script Include and a OnChange Client script which is working fine for form label which means if I update the Install Status of a DB CI to Disposed, then automatically the current date & time is reflecting on Decommission Date variable (It'll be mandatory & visible on the form on form level if the Install Status is Disposed).
However, when I'm updating the Install Status of the DB CIs through list view, then the Status is being updated to Disposed but the Decommission Date is showing mandatory & blank. It should take the current date & time.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 06:46 AM
Client scripts will work only on the forms, so we need to create a server side script i.e., business rule in this case to update the field
Create a before insert/update business rule with trigger conditions as
Install status changes to Disposed
Decommission date is empty
Check advanced and write the script as
(function executeRule(current, previous /*null when async*/) {
current.decommission_date = new GlideDateTime().getDisplayValueInternal();//CHANGE THE FIELD NAME AS PER YOUR INSTANCE
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2024 06:46 AM
Client scripts will work only on the forms, so we need to create a server side script i.e., business rule in this case to update the field
Create a before insert/update business rule with trigger conditions as
Install status changes to Disposed
Decommission date is empty
Check advanced and write the script as
(function executeRule(current, previous /*null when async*/) {
current.decommission_date = new GlideDateTime().getDisplayValueInternal();//CHANGE THE FIELD NAME AS PER YOUR INSTANCE
})(current, previous);