Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Help changing out of box description and short description

Gemma4
Mega Sage

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

 

(function executeRule(current, previous /*null when async*/) {
 
// Add your code here
var gr= new GlideRecord("sc_req_item");
gr.addQuery('request', current.sys_id);
 
gr.addQuery('cat_item','cd0f6ba497b871102ab77d100153afd4');
 
gr.query();
if(gr.next()){
current.short_description=gr.variables.request_name;
}
 
 
})(current, previous);

 

 
6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

If you're running this BR on the sc_req_item table, you don't need to do a GR to retrieve the same record.  If you only want this to run for a specific Catalog Item, add that to the When to run Filter conditions.  If you have a variable named request_name, try a one-line script within the defined function:

 

current.short_description = current.variables.request_name;

 

 

Hi @Brad Bowman  

I tried to use the following script and condition in a br. The change only needs to impact the Test Catalog Item. But no luck yet. 

when to run before update 

Condition current.cat_item=='Test Catalog Item' 

 

 

(function executeRule(current, previous /*null when async*/) {
current.short_description = current.variables.request_name;
// Add your code here
 
})(current, previous);

If you are testing this by submitting a new request from this Catalog Item, change the Business Rule to before Insert so that it is triggered when the sc_req_item record is getting created.  This record is not updated until your flow or workflow kicks in, which is another place that you could add this script/action.

Hi @Brad Bowman  

I tried your suggestion but no luck. Attached are the 2 business rules I believe are impacting this. So far I have the variable on description and the catalog item on short description. However, I believe it should be the opposite- request name on short description and catalog item name on description. I've tried changing these and then nothing works. Any suggestions. Attached is a copy of the br and examples.