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 Email Notification to Assigned to when Additional Comment is added

Jonathan102
Tera Guru

Hi,

 

I am trying to create an email notification to be sent to the Assigned to of a SCTASK when an end user/opened by adds a new comment through the service portal.  The issue we are facing is when a user adds a comment to the ticket (RITM) in the portal, we don't know unless we continually open the ticket and look.

 

Thanks,

Jonathan 

1 ACCEPTED SOLUTION

Robert H
Mega Sage

Hello @Jonathan102 ,

 

Here is solution that will not only trigger a notification but also copy the user's comment to the Work notes of the SCTASK itself for better visibility.

 

Create a new Business Rule configured like this:

RobertH_0-1743706443564.png

 

Put the following code into Advanced > Script, or adjust as desired.

(function executeRule(current, previous /*null when async*/ ) {

    var grTasks = new GlideRecord('sc_task');
    grTasks.addQuery('request_item', current.getUniqueValue());
    grTasks.query();
    while (grTasks.next()) {
        grTasks.work_notes = 'Comment added to RITM: ' + current.comments.getJournalEntry(1);
        grTasks.update();
    }

})(current, previous);

 

This will trigger the OOTB "Catalog task worknoted" Notfications to the task Assignee or Assignment group.

 

I verified that this works fine in Service Portal.

 

Regards,

Robert

View solution in original post

10 REPLIES 10

@Jonathan102 

email script is added to notification i have miss to upload screenshot of that step configure as below in the notification in what it will contain body.

 

swapnaliombale_0-1743776127177.png

 

it will resolved your issue let me know once it is working as per your requirement.