Short Description of Request same as Cat Item name

Community Alums
Not applicable

Hi Experts,

We have a requirement to update REQUEST short description same as Catalog Item name. I followed this Article but it updates both RITM and Request short description. We just want to update only REQUEST SD not RITM's. Can someone help me on this?

Thanks,

1 ACCEPTED SOLUTION

Pavankumar_1
Mega Patron

Hi @Community Alums ,

On RITM short description will get the catalog item short description not catalog item name.

So, if you are working on the catalog name to populate on Request short description use below script.

1. Create after business rule on RITM table and try this script.

(function executeRule(current, previous /*null when async*/ ) {
    var req = new GlideRecord('sc_request');
    req.addQuery('sys_id', current.request);
    req.query();
    if (req.next()) {
        req.short_description = current.cat_item.name.toString();
        req.update();
    }
})(current, previous);

Catalog item: See below screen name and short description is different.

Screenshot (523).png

 

Result: RITM short description field is filled with catalog short description and Request short description is catalog name which populating through business rule.

Screenshot (524).png

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

6 REPLIES 6

RaghavSh
Kilo Patron

Create an after insert BR on RITM table:

var req = new GlideRecord('sc_request');
req.get(current.request);
req.short_description = current.cat_item.name.toString();
req.update();

 

If you are using workflow you can use the same code in run script activity.


Raghav
MVP 2023

@Community Alums is your issue resolved.


Raghav
MVP 2023

Mike_R
Kilo Patron
Kilo Patron

That article that you linked looks fine. It will only update the Short Description for Requests.

 

OOTB, RITM short descriptions are automatically populated so that's something different.

 

Pavankumar_1
Mega Patron

Hi @Community Alums ,

On RITM short description will get the catalog item short description not catalog item name.

So, if you are working on the catalog name to populate on Request short description use below script.

1. Create after business rule on RITM table and try this script.

(function executeRule(current, previous /*null when async*/ ) {
    var req = new GlideRecord('sc_request');
    req.addQuery('sys_id', current.request);
    req.query();
    if (req.next()) {
        req.short_description = current.cat_item.name.toString();
        req.update();
    }
})(current, previous);

Catalog item: See below screen name and short description is different.

Screenshot (523).png

 

Result: RITM short description field is filled with catalog short description and Request short description is catalog name which populating through business rule.

Screenshot (524).png

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar