
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 12:20 PM
Hi all,
Was wondering if anyone could help me get the Short Description set on a Request when placing an order from an Order Guide. Currently, when submitted, it shows all Catalog Items on the Short Description which doesn't do well for reporting. What I did was set a Business Rule on the sc_request table, however it over rides all Requests.
Here is the code I am using, and hoping there is a way to isolate this Business Rule to only run if it's the Order Guide being used.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.sys_id);
gr.query();
if (gr.next()) {
current.short_description = 'Termination' + ' - ' + gr.variables.person_leaving.getDisplayValue() + ' - ' + gr.variables.end_date.getDisplayValue();
current.requested_for = gr.variables.requested_for;
current.description = 'Please refer to the Termination Checklist Knolwedge Article: ;
}
})(current, previous);
Anyone out there have any ideas? As always, I appreciate your help!
Thank you
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 10:52 PM
Hi,
there is this field Order Guide on RITM which would help you identify whether this RITM got created from order guide or not
you can use that column
please find updated script below for your BR
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.sys_id);
gr.addQuery('order_guide', '!=', ''); // if order guide is not empty check
gr.query();
if (gr.next()) {
current.short_description = 'Termination' + ' - ' + gr.variables.person_leaving.getDisplayValue() + ' - ' + gr.variables.end_date.getDisplayValue();
current.requested_for = gr.variables.requested_for;
current.description = 'Please refer to the Termination Checklist Knolwedge Article: ;
}
})(current, previous);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 12:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 10:24 PM
Hi
Let me know, if using the condition worked.
Please mark the response as helpful and correct answer, if it helped.
Regards,
Anirban
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2020 10:52 PM
Hi,
there is this field Order Guide on RITM which would help you identify whether this RITM got created from order guide or not
you can use that column
please find updated script below for your BR
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.sys_id);
gr.addQuery('order_guide', '!=', ''); // if order guide is not empty check
gr.query();
if (gr.next()) {
current.short_description = 'Termination' + ' - ' + gr.variables.person_leaving.getDisplayValue() + ' - ' + gr.variables.end_date.getDisplayValue();
current.requested_for = gr.variables.requested_for;
current.description = 'Please refer to the Termination Checklist Knolwedge Article: ;
}
})(current, previous);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2020 08:53 AM
Thank you very much for the help, this did the trick, all other Requests are working properly now, and the Off-boarding Order Guide is labeling the Short Description properly as well. Thanks again!