Populate sc_request Description from Order Guide

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 01:06 PM
I searched the forums and found quite a few people asking this question but I couldn't get an answer that worked. We are using an order guide for employee onboarding so I want to see the description of the REQ populated with "Onboarding: John Doe".
Since the request is created after the order guide is submitted I can't do this with a client script. I guess I could create a business rule or embed this in the sc_request default workflow but how would I know if that particular request originated from an order guide? And how would I get the new employees information from the order guide?
Thanks all,
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 01:24 PM - edited 02-22-2023 01:24 PM
Hi,
You can write an onAfter Business Rule on RITM table as below -
(function executeRule(current, previous /*null when async*/) {
//Add your code here
var req = new GlideRecord('sc_request');
req.addQuery('sys_id',current.request);
req.query();
if (req.next()){
// standalone catalaog item
if (current.order_guide.nil()){
req.short_description = current.cat_item.name;
req.description = current.cat_item.short_description;
}
else {
// Order Guide
req.short_description = current.order_guide.name;
req.description = current.order_guide.short_description;
}
req.setWorkflow(false);
req.update();
}
})(current, previous);
Thanks and Regards,
Saurabh Gupta

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 01:48 PM
Hi Saurabh,
Thank you for your response. The problem with this methodology is that it will run for all the requested items in the order guide and each requested item will try to overwrite that same description in their parent request. Our order guide generates 7 different request items. Is there a way to make this run only once per request?
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 01:54 PM
Hi @Brian Hofmeiste ,
In the condition builder put a condition that request.short_description is EMPTY.
Thanks and Regards,
Saurabh Gupta

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 03:14 PM - edited 02-22-2023 03:39 PM
I'm having trouble getting a simple business rule to work - I have to be missing something simple. Before adding your suggested code I am doing a simple setup and the RITM is not receiving the test information. Am I missing something simple here? Here are screenshots.