I want to suppress OOTB notifications for specific catalog items

bonsai
Mega Sage

I don't want to send OOTB notifications "Request approved" or "Request was opened" when I submit and approve a specific catalog item.

I wanted to control it with the condition field of the notification, but it doesn't work,Request approved.JPGRequest was opened.JPG

 

I tried setting the following script as the notification record sending condition, but it did not work properly...
I would like to consider processing without using scripts if possible.

If a catalog item other than a specific catalog item is submitted and approved, I would like to send "Request approved" and "Request was opened" as usual.

 

//Wait 3 seconds (Wait until the requested item record is created. It will be created in about 1 second, but just to be safe, wait 3 seconds)
gs.sleep(3000);

//Identification of request item record linked to request record
var tmp_req_rec = new GlideRecord("sc_req_item");
tmp_req_rec.addQuery("request", current.getUniqueValue());
tmp_req_rec.query();

//Judgment processing if the requested item record can be identified
if (tmp_req_rec.hasNext()) {
    tmp_req_rec.next();

	//Get catalog item name of requested item record
    var cat_item_name = tmp_req_rec.getDisplayValue("cat_item");

	//If the catalog item name is "XXXX" or "YYYY", the email sending process will be canceled.
    if (cat_item_name == "XXXX" ||
        cat_item_name == "YYYY"){
			answer = false;
		}
    //Submit processing for other catalog items
    else{
		answer = true;
	}

//Send email if requested item record cannot be identified
} else {
    answer = true;
}

 

1 ACCEPTED SOLUTION

If it doesnt work. Create a reference field on request table which references to catalog item table and place the condition in notification filter

"fieldName" isnot "your catalog name"

and update this field with catalog name when you submit a request for catalogs so that notification can validate this condition on your request.

Regards
Harish

View solution in original post

7 REPLIES 7

If it doesnt work. Create a reference field on request table which references to catalog item table and place the condition in notification filter

"fieldName" isnot "your catalog name"

and update this field with catalog name when you submit a request for catalogs so that notification can validate this condition on your request.

Regards
Harish

Is it a business rule to populate a catalog item field in a request record?

Should I create a business rule that operates when a request record is inserted?

Or is it a business rule that runs when a requested item record is inserted?

I created a business rule that populates the description field with the catalog item name without adding any fields.
When I set the condition to work when inserting a request record, it worked as expected.