Issue
Description
How to set a sc_request field value based on whether the record was generated from the Service Portal or Platform
Procedure
The solution is basically to examine the URI
- Create a new custom field on sc_request which would store the value of where the sc_request was originated from
- Create a new Business Rule
- Set Table = sc_request
- Check the 'Advanced' checkbox
- On 'When to run' tab, When = Before, Insert = checked, Update = checked
- Script:
(function executeRule(current, previous /*null when async*/) {
var action = gs.action.getGlideURI().toString();
if (action.indexOf('service_catalog.do') > -1) {
current.<newField> = 'from_platform';
}
else
current.<newField> = 'from_service_portal';
})(current, previous);
NOTE: This is just a suggested solution which customers can customize, however it is not officially supported as out of box functionality.
Applicable Versions
All