- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2020 05:00 AM
Hi All,
Requested for is populating empty for the RITM Created for the item.
I have the below business rule written on sc_req_item table.
Condition: current.request.requested_for != current.variables.requested_for
(function executeRule(current, previous /*null when async*/ ) {
var grREQ = new GlideRecord('sc_request');
grREQ.get(current.getValue('request'));
grREQ.setValue('requested_for', current.variables.requested_for);
grREQ.update();
gs.log(grREQ, " Requested For");
})(current, previous);
On RITM and REQ Requested For is empty:
if the disable the above business rule, the items which has the requested for variable, in those RITM requested for is empty.
Please help to resolve this issue.
Thanks
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2020 05:41 AM
The Service Portal Order Confirmation Request for field as shown in your first screenshot is different than a variable that you may have on a catalog item named requested_for, so with the way you've written your business rule script, that's why it's overriding the OOTB rule that would set Requested for on the REQ (and RITM, though that's really the REQ shown on the RITM form) and is blank - when the variable doesn't exist. If you inactivate this rule and the Requested for as shown on the Service Portal Order Confirmation page is populated on the REQ, then that's good news as the OOTB rule is still working. If you want a Requested for variable to populate the field on the REQ when this variable exists, your sc_req_item business rule script should look like this
(function executeRule(current, previous /*null when async*/ ) {
if(current.variables.requested_for){
var grREQ = new GlideRecord('sc_request');
grREQ.get(current.getValue('request'));
grREQ.setValue('requested_for', current.variables.requested_for);
grREQ.update();
gs.log(grREQ, " Requested For");
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2020 05:41 AM
The Service Portal Order Confirmation Request for field as shown in your first screenshot is different than a variable that you may have on a catalog item named requested_for, so with the way you've written your business rule script, that's why it's overriding the OOTB rule that would set Requested for on the REQ (and RITM, though that's really the REQ shown on the RITM form) and is blank - when the variable doesn't exist. If you inactivate this rule and the Requested for as shown on the Service Portal Order Confirmation page is populated on the REQ, then that's good news as the OOTB rule is still working. If you want a Requested for variable to populate the field on the REQ when this variable exists, your sc_req_item business rule script should look like this
(function executeRule(current, previous /*null when async*/ ) {
if(current.variables.requested_for){
var grREQ = new GlideRecord('sc_request');
grREQ.get(current.getValue('request'));
grREQ.setValue('requested_for', current.variables.requested_for);
grREQ.update();
gs.log(grREQ, " Requested For");
}
})(current, previous);