business rule to fire event in custom scoped app

NeelyC
Tera Contributor

i am trying to fire my event from a business rule.

i need to send a message to the assignee when an additional comment (comments) field is updated by the caller. 

something isn't really working.

 

my business rule:

Screenshot 2025-07-21 at 17.04.24.png

 

(function executeRule(current, previous /*null when async*/ ) {
var caller = current.opened_by;
var assignTo = current.assigned_to;
var groupMng = current.assignment_group.manager;
 
if (current.updated_by == caller) {
var url = '<a href="/esc?sys_id=' + current.sys_id + '&view=portal&id=ticket&table=x_1776226_mobile_1_custom_mobile_issues">' + current.number + '</a>';
if (assignTo)
gs.eventQueue('x_1776226_mobile_1.add_comm_by_caller', current, assignTo, url);
else
gs.eventQueue('x_1776226_mobile_1.add_comm_by_caller', current, groupMng, url);
// }
})(current, previous);
 
 
 
my event:
 Screenshot 2025-07-21 at 17.10.07.png

 my notification:

Screenshot 2025-07-21 at 17.11.18.png

Screenshot 2025-07-21 at 17.11.25.png

 i would much appreciate your help

1 ACCEPTED SOLUTION

@NeelyC 

why it wouldn't trigger if comments are added via employee center?

I don't think it will stop triggering.

It's a record update and if condition matches it will send email

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

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@NeelyC 

why are you using Event, Business rule?
You can directly configure Notification to trigger when Additional Comments Changes and have recipient there.

In notification advanced condition check if the updated by is caller

if (current.sys_updated_by.toString() == current.opened_by.user_name.toString())
    answer = true;
else
    answer = false;

AnkurBawiskar_0-1753108955202.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

yes. that works when the additional comments are added via back office/SOW. but when i add comments from the employee center it doesn't.

@NeelyC 

why it wouldn't trigger if comments are added via employee center?

I don't think it will stop triggering.

It's a record update and if condition matches it will send email

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