Approval Notification exclusions not working

Venjamin
Tera Contributor

I am trying to exclude a notification. I set up a secondary approval notification for a specific item, but I can't seem to exclude items from the normal approval notification. I added the following: 

 

 

 

// Seems I should be able to put this logic in the condition builder (Approval for.Request Item.Item is Not 'Contractor Monthly Review') but not working
answer = true;
// 'Contractor Monthly Review' request item sys_id = 16172199db199410e4221fdc139619f2
if (current.sysapproval.cat_item == '16172199db199410e4221fdc139619f2' || current.sysapproval.cat_item == '760d2315db491450e4221fdc13961986' || current.sysapproval.cat_item == '7cc3b519893e08690fb70bacc5cba104d') {
    answer = false;
}

 

 

And yet I'm still firing 2 approval notifications. Any specific thing you're seeing that I might have missed?

1 ACCEPTED SOLUTION

I see the problem, sysapproval is a reference to the task table which does not have cat_item on it. So we need to do a lookup with GlideRecord.

 

var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.sysapproval);
gr.query();
if (gr.next()) {//check to verify this isa catalog item
    if (gr.cat_item == '16172199db199410e4221fdc139619f2' || gr.cat_item == '760d2315db491450e4221fdc13961986' ||
        gr.cat_item == '7cc3b519893e08690fb70bacc5cba104d') {//do not sent notification
        answer = false;
    } else { //send notification when not one of the above catalog items
        answer = true;
	}
}
else { //send notification when not a catlog item
	answer = true;
}

 

View solution in original post

6 REPLIES 6

Yes the same thing should work for approval group. You just may need to check the column name are the same on approval group as they are on approval table.

Josh Pirozzi
Kilo Sage

Hi @Venjamin,

 

Have you tried setting this on the Approval Notification record conditions? You should be able to select the Catalog Item(s) you'd like to exclude and those you'd like to include from the 'When to Send' Conditions. 

 

Hope this helps,

Josh Pirozzi