Event Queue-Trigger Notification From Business rule

Nikitha A1
Tera Contributor

Hi,

Can someone help me with how to trigger Notification from Business rule. I want to trigger notification to assiged_to on ScTASK.

This is the script that i have added:

var gr1 = new GlideRecord('sc_task');
gr1.addEncodedQuery('active=true^stateIN-5,1,2^request_item.requested_for=' + current.sys_id);
gr1.query();
while (gr1.next()) {
//gs.log("Records count" + gr1.getRowCount() + gr1.number);
gr1.comments.setJournalEntry('Requesting fulfiller to Close-Incomplete the task as requestor is no longer part of organisation.', 'admin');
gr1.update();
gs.eventQueue('notify_email_to_fulfiller',current,gr1.assigned_to);

}

 

This is not working!

 

please help me with the event and how to add that on BR

Thanks in advance.

Regards,

Nikitha

4 REPLIES 4

Uncle Rob
Kilo Patron

"Not working" in what way.  Is the event actually firing?

If so, do you have a notification configured to trigger off that event?
- If so, do you have any further conditions on the notification that may prevent successful send?
-- If not, are you testing with your own email address and have "send to event creator" unchecked?

Hi Robert,

i have created notification and fired event there.

and also created an event as attached in the screenshot.find_real_file.png

But from BR its not working. Please find_real_file.pngfind_real_file.png Suggest me the changes for the above script to trigger that event.

 

ersureshbe
Giga Sage
Giga Sage

Hi, Can you check the eventQueue syntax in your code and check event logs.

gs.eventQueue("incident.commented", current, gs.getUserID(), gs.getUserName());

Can you check the notification template as correct event name configured and check the event parameter enabled.

Name Type Description
name String Name of the event being queued.
glideRecord Object GlideRecord object, such as "current".
parm1 String (Optional) Saved with the instance if specified.
parm2 String (Optional) Saved with the instance if specified.
queue String Name of the queue.

This screenshot part of notification template comes under 'Who will Receive' tab.

find_real_file.png

Please mark as correct answer if it helped.

 

Regards,

Suresh.

Regards,
Suresh.

ersureshbe
Giga Sage
Giga Sage

Hi,

You have an other option to troubleshoot. 

gs.eventQueue('notify_email_to_fulfiller',current,gr1.assigned_to); Keep this code only in business rule and comment other codes. Remove your filter condition in business rule and you should check only 'update' action. 

Once done - try to update the maually then check the event logs and emails. If not triggered you should fix the above one line code and notification template.

Please mark as correct answer if it helped.

Regards,

Suresh.

Regards,
Suresh.