- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2022 08:59 AM
I have occasions where reviewers or fulfillers may need to change a value added by the requestor. Other than having to write a lot of AJAX On Change Catalog Client Scripts, is there anyway to note those changes into the activities for the given item (sc_req_item)?
TIA for any insights you can offer.
:{)
:{)
Helpful and Correct tags are appreciated and help others to find information faster
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 12:04 PM
Actually, it's sc_item_option where the BR lives:
if (previous.value != current.value) {
var var_owner = new GlideRecord('sc_item_option_mtom');
var_owner.addQuery('sc_item_option', current.sys_id);
var_owner.query();
if (var_owner.next()) {
var itm = new GlideRecord('sc_req_item');
itm.addQuery('sys_id', var_owner.request_item);
itm.query();
if (itm.next()) {
itm.comments = 'Variable updated ' + current.item_option_new.getDisplayValue() + ' value changed from ' + previous.value.getDisplayValue() + ' to ' + current.value.getDisplayValue() + ' By ' + gs.getUserName();
itm.update();
}
}
}
This is an after update rule.
:{)
:{)
Helpful and Correct tags are appreciated and help others to find information faster

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 07:49 AM
Did you consider using Variable Ownerships(sc_item_option_mtom) table?
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2022 12:04 PM
Actually, it's sc_item_option where the BR lives:
if (previous.value != current.value) {
var var_owner = new GlideRecord('sc_item_option_mtom');
var_owner.addQuery('sc_item_option', current.sys_id);
var_owner.query();
if (var_owner.next()) {
var itm = new GlideRecord('sc_req_item');
itm.addQuery('sys_id', var_owner.request_item);
itm.query();
if (itm.next()) {
itm.comments = 'Variable updated ' + current.item_option_new.getDisplayValue() + ' value changed from ' + previous.value.getDisplayValue() + ' to ' + current.value.getDisplayValue() + ' By ' + gs.getUserName();
itm.update();
}
}
}
This is an after update rule.
:{)
:{)
Helpful and Correct tags are appreciated and help others to find information faster