Stop a notification configured on REQ table of a particular catalog item

Nikita50
Tera Expert

Hi All,

 

Notification "Request has been opened" configured on sc_request table, needs to be stop for a particular catalog item. How to achieve that?

Please suggest.

3 REPLIES 3

JenniferRah
Mega Sage

The Catalog Item is associated with the RITM (sc_req_item), not the REQ (sc_request). So if you are sending a notification on the REQ, there's no way to filter out the ones for a particular Catalog Item, since you can have multiple RITMs per REQ. If you change your notification to go out about the RITM, you can easily filter out particular Catalog Items.

 

If you really need it to be on the REQ, you may have to create a Business Rule that runs when a REQ is submitted and triggers an event if it doesn't contain the Catalog Item you want. Then change the notification to run when the event is triggered.

Hi Jennifer.. Could you please help me with Business Rule code.

If you are modifying the OOTB "sc request events" Business Rule, then you would change these lines 

if (current.operation() == 'insert') {
 gs.eventQueue("sc_request.inserted", current, gs.getUserID(), gs.getUserName());
}

to be something like this, changing the value to be your catalog item name:

if (current.operation() == 'insert') {
    var ritm = new GlideRecord('sc_req_item');
    ritm.addQuery('request', current.sys_id);
    ritm.addQuery('cat_item.name', 'Your catalog item name');
    ritm.query();
    if (!ritm.next()) {
        gs.eventQueue("sc_request.inserted", current, gs.getUserID(), gs.getUserName());
    }
}