Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Send notification with the comment from approval

Yahav Mor
Tera Contributor

Hi 
I need when the approver rejected.

what he send in the comment will send notification to the user that  open change request

YahavMor_0-1707814230287.png

 

 

2 REPLIES 2

Maddysunil
Kilo Sage

@Yahav Mor  

You can write before update business rule on that table , condition : state changes to rejected

in script you can call gs.eventQueue() method:

gs.eventQueue('change.rejected', current, gs.getUserID(), gs.getUserName());

then you can use that event to configure notification.

 

Thanks

Please mark my response helpful!

Service_RNow
Mega Sage

Hi @Yahav Mor  

 

1. Create a mail script by navigating to System Notification >> Email >> Notification mail script

2. Name it getlatestcommentsonly with script as below.

(function runMailScript(current, template, email, email_action, event) {

    var latestcommentsare = current.comments.getJournalEntry(1);
    template.print(latestcommentsare);

})(current, template, email, email_action, event);
3. Go to notification & add below just after the line Short description: ${short_description}

Comments: ${mail_script:getlatestcommentsonly}

If my answer helped you in any way, please then mark it as helpful or correct.