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

Hello @Jonathan102 ,

 

Have you tried this, or are there any concerns with the suggested solution?

 

Regards,

Robert

swapnali ombale
Kilo Sage

Hi @Jonathan102 ,

 

please follow below process it is working as per your requirement and it is tested on my PDI

 

1. create event 

2.create business rule

3. create Notification

4. create email script

 

1. create event

filter navigator->system policy->event->registry-> new

swapnaliombale_0-1743716735621.png

 

2,Business rule:

system definition->business rule->new

swapnaliombale_1-1743716985856.png

 

swapnaliombale_2-1743717036494.png

3. notification :

system notification->notifications

 

swapnaliombale_4-1743717200150.png

 

swapnaliombale_5-1743717229996.png

email script :

system notification->notification email script

swapnaliombale_7-1743717392178.png

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. 

 

Thank you so much for the information.  The issue I am seeing with it is the fact that we do not set the Assigned to field on the RITM, only on the SCTASK.  Based on how I understand the above, the notification is reflecting the RITM table, correct?

 

Thanks,

Jonathan 

@Jonathan102 

 

Yes if you want for sctask then you have to replace ritm table with sc task table that's it it will work for sctask as well

 

 

Mark my answer correct if it help you anyway 

Thank you!  I've tried this but it's not working.  I am unsure how the email script is connected to the other items.  I don't see anything in the script to link it.