Help changing out of box description and short description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2023 11:26 AM
Can I get help changing the out of the box short description and for sc_req_item.
Currently the Short Description field is the item being ordered. If the item does not have a short description, then the Request Item's short description is set to the item name.
Where is this default behavior defined? Is it a Business Rule? A workflow?
I am trying to override the default behavior because I need to add a variable from the catalog item, but nothing I try is working.
I've tried creating a before Business Rule but it doesn't seem to be working as expected. Does anyone have any suggestions.
Below is the br I tried with no luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 09:06 AM
By the way @Brad Bowman a little history on why we want to change the scripts is on the portal short description is displayed and the user needs to see request name and I can't get description visible...so if that is easier to add description to the portal we could do that also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2023 11:10 AM
There's a couple things you can do to simplify and clarify this. If I'm following correctly, you want to update the Description and Short Description fields on the RITM, so let's start by confirming we can do that. Inactivate these 2 Business Rules and start simple, then you can tweak the results if it's getting triggered when you don't want it to. Start with one Business Rule on the sc_req_item table before Insert with no Filter Condition or Condition. The script is simply:
(function executeRule(current, previous /*null when async*/) {
current.short_description = current.variables.request_name;
current.description = current.variables.request_title;
})(current, previous);
or whatever makes sense with your variable names. Try this using the native UI first - submit the Catalog Item request form, then view the actual RITM record. You may notice on the order summary page after submitting the order, the Description is the Catalog Item Description, but then when you view the RITM record, the Description and Short Description reflect the variables. Once you confirm this is working, Portal is a whole different issue. Your widgets could be displaying the Description and/or Short Description of the REQ record instead of the RITM. So if it still looks wrong in Portal, you'll want the same one Business Rule since the RITM is created after the REQ, but you'll want to change the script to something more like what you initially tried, but you're going to lookup the REQ record, and save the changes with update():
(function executeRule(current, previous /*null when async*/) {
var gr= new GlideRecord("sc_request");
gr.addQuery('sys_id', current.request);
gr.query();
if (gr.next()) {
gr.short_description = current.variables.request_name;
gr.description = current.variables.request_title;
gr.update();
}
})(current, previous);