How can we configure Business Rule so that the data in expiring date field gets updated on template
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2024 12:25 AM
I have added a field as Expiring date(u_expiring_date) on a standard change proposal (std_change_proposal) whenever a request is submitted to modify or create a change template expiring date field is getting updated on Standard Change Proposal (std_change_proposal), how can we configure Business Rule so that the data in expiring date field gets updated on Standard Change template (std_change_record_producer).
Business Rule I have written on std_change_proposal table :
(function executeRule(current, previous /*null when async*/ ) {
var c = current.current_version;
var recordp = new GlideRecord('std_change_record_producer');
recordp.addQuery('sys_id', c);
recordp.query();
if (recordp.next()) {
recordp.u_expiring_date = current.u_expiring_date;
recordp.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2024 11:23 PM
try to enter some logs at each step and check where it gets stuck and if it takes the data in the variables correctly. If it doesn't work, let us know and we'll try it on a test instance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2024 12:32 AM
Hi @divyal09 ,
Please make sure your BR is before and add below script
(function executeRule(current, previous /*null when async*/ ) {
if (current.current_version) {
var recordp = new GlideRecord('std_change_record_producer');
recordp.addQuery('sys_id', current.getValue("current_version"));
recordp.query();
if (recordp.next()) {
var gd = new GlideDateTime("current.u_expiring_date");
recordp.u_expiring_date = gd;
gs.log("Inside if = " + gd) // Check in logs table for this log
recordp.update();
}
}
})(current, previous);
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak