- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 10:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2022 01:39 AM
It is solved, I needed to add GR for getting the recipient's name.
(function executeRule(current, previous /*null when async*/ ) {
function checkRemainingHours() {
var isZero = true;
var gr = new GlideRecord('service_entitlement');
gr.addQuery('account', current.account);
gr.query();
while (gr.next()) {
if (gr.remaining_units != 0) {
isZero = false;
break;
} else {
isZero = true;
}
}
return isZero;
}
if (checkRemainingHours() == true) {
var grTwo = new GlideRecord('customer_account');
grTwo.addQuery('sys_id', current.account);
grTwo.query();
if (grTwo.next()) {
gs.eventQueue('cd.primary.contact.entitlement.mail', current, grTwo.primary_contact);
}
}
})(current, previous);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 10:08 AM
Not sure if you should have dots in your event name. I think you should replace those with underscore.
Also you should add some debug statement such as gs.addInfoMessage to check, if it enters the if condition.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2022 11:03 PM
I've added gs.addinfo and it's working fine I just want to trigger the notification.
- have created the events with dots if we check out of the box name of events then dots
are in the name
- in notification, I've selected the event and selected the event param one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2022 01:39 AM
It is solved, I needed to add GR for getting the recipient's name.
(function executeRule(current, previous /*null when async*/ ) {
function checkRemainingHours() {
var isZero = true;
var gr = new GlideRecord('service_entitlement');
gr.addQuery('account', current.account);
gr.query();
while (gr.next()) {
if (gr.remaining_units != 0) {
isZero = false;
break;
} else {
isZero = true;
}
}
return isZero;
}
if (checkRemainingHours() == true) {
var grTwo = new GlideRecord('customer_account');
grTwo.addQuery('sys_id', current.account);
grTwo.query();
if (grTwo.next()) {
gs.eventQueue('cd.primary.contact.entitlement.mail', current, grTwo.primary_contact);
}
}
})(current, previous);