Notification on Approval Table

Abhilasha G T
Tera Contributor

Hi Team,

I need to configure a Notification , requirement is like below,

Table - Approval (sysapproval_approver)

 

When to send > 

 

source Table is > sc_req_item

state is > Requested

catalogs contains > service catalog

 

who will Receive > Approver

 

how to configure this.

 

Regards,

Abhilasha G T

 

7 REPLIES 7

J Siva
Tera Sage

Hi @Abhilasha G T 

The requirement is very clear and if you follow the same, then you will be able to get that done easily..

You can achieve this in different ways and one of the ways is using event registry & business rule.

Let us know where you stuck..

Regards,

Siva

hi Siva,

Facing difficulty to cater below requirement in,

When to send,

catalogs contain > service catalog

finally achieved this, by using below script ,

answer = false;
var ritmGR = new GlideRecord("sc_req_item");
if (ritmGR.get(current.document_id)){
var catalogs = ritmGR.cat_item.sc_catalogs.getValue();
// Don't hardcode the sys_id , create a system proprety and store the value and use gs.getProperty

 

answer = catalogs && catalogs.indexOf("e0d08b13c3330100c8b837659bba8fb4") >= 0 ;
}

 

Regards,

Abhilasha G T

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Abhilasha G T 

Seems some other person also raised same question

https://www.servicenow.com/community/developer-forum/ritm-notification-request-approval-assigned/m-p...

there is already OOTB approval email which goes when approval is raised for RITM

why you want to create another one?

This is the OOTB email notification

AnkurBawiskar_0-1752586667741.png

 

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@Abhilasha G T 

if you are saying approval email needs to be sent on RITM only if RITM->Catalog Item->Service Catalog

Then do this in OOTB email in advanced notification condition

if (current.source_table == 'sc_req_item') {
    var ritmSysId = current.sysapproval;
    var ritmRec = new GlideRecord('sc_req_item');
    ritmRec.addEncodedQuery('cat_item.sc_catalogsLIKEe0d08b13c3330100c8b837659bba8fb4');
    ritmRec.addQuery('sys_id', ritmSysId);
    ritmRec.query();
    answer = !ritmRec.hasNext();

} else {
    answer = true; // don't check if the approval is not for RITM
}

AnkurBawiskar_1-1752586969880.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader