How to send mail to approver on ritm if any comment has been made in the ritm by the requestor

Shalika
Tera Expert

How to send mail to approver on ritm if any comment has been made in the ritm by the requestor

1 ACCEPTED SOLUTION

Mahendra RC
Mega Sage

Hello Shalika,

I am not sure what will be the best approach to implement this requirement in your instance but you can do the following:

1. Create an event in sysevent_register table with Name as sc_req_item.commented.approver and Table as sc_req_item.

2. Create an after update BR on sc_req_item table with condition and script as shown below:

Script Condition: current.comments.changes() && gs.getUserID() == current.requested_for

(function executeRule(current, previous /*null when async*/ ) {
    var lastComments = current.comments.getJournalEntry(1);
    var approverList = [];
    var sysApprovalGR = new GlideRecord("sysapproval_approver");
    sysApprovalGR.addEncodedQuery("sysapproval=" + current.getUniqueValue() + "^state=requested");
    sysApprovalGR.query();
    while (sysApprovalGR.next()) {
        approverList.push(sysApprovalGR.getValue("approver"));
    }
    if (approverList.length && lastComments) {
        gs.eventQueue("sc_req_item.commented.approver", current, approverList, lastComments);
    }

})(current, previous);

3. Create a notification on sc_req_item table with below details:

find_real_file.png

find_real_file.png

Subject: ${number} has been commented by ${requested_for}

in Message field you can put the below content:

find_real_file.png

You can make changes as per your requirement in email content.

Please mark my respsone as helpful/correct, if it answer your question.

Thanks

View solution in original post

7 REPLIES 7

umaaggarwal
Giga Guru
Giga Guru

Hi Shalika,

 

Do you just want to send email to approver for the information or you want to get approval/rejection as well ?

 

Regards!

Uma

I just want to send email to approver 

Murthy Ch
Giga Sage

Hi @Shalika 

Can you please elaborate more?

Content of the notification?

Only for specific catalog or for all catalogs?

Share the business usecase

Thanks,

Murthy

Thanks,
Murthy

The content of the notification will be the comment that is made by the requested for in the ritm. I want this only for a particular catalog item