- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2024 05:03 AM
when new emergency change create send notification all vip users in business rule using with event.
Solved! Go to Solution.
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2024 08:30 AM
Hi @AJAYKUMAR G ,
You can do one small change to send email to VIP Users
IN BR
(function executeRule(current, previous /*null when async*/ ) {
    // Add your code here
    var arrEmail = [];
    var gr = new GlideRecord('sys_user');
    gr.addQuery('vip', true);
    gr.query();
    while (gr.next()) {
        arrEmail.push(gr.sys_id.toString());
    }
    gs.log("arrEmail = " + arrEmail);
    gs.log("current.assigned_to.email = " + current.assigned_to.email);
    gs.eventQueue('emergency.change', current, arrEmail);
})(current, previous);Add this code
And in Notification pls do below thing
You have to check true to this parm 1 and parm 2 variable
Result
I have this 3 user is VIP and if we check the Email logs
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2024 06:43 AM - edited 04-26-2024 06:44 AM
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2024 06:38 AM
Hi @AJAYKUMAR G ,
I tried your problem in my PDI and it's working fine for me
Please use below reference
1. Create Before BR
Add below script
(function executeRule(current, previous /*null when async*/) {
	// Add your code here
	gs.log("current.assigned_to.email = " + current.assigned_to.email);
	gs.eventQueue('emergency.change', current, current.assigned_to.email);
})(current, previous);2. Create Event from Event Registry
3. Create Notification
Add VIP users here
You can add your content here
Result :
When I change the type to Emergency Email triggered
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2024 07:34 AM
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2024 07:41 AM
@AJAYKUMAR G 
Did you try what I have attached? 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
04-26-2024 08:30 AM
Hi @AJAYKUMAR G ,
You can do one small change to send email to VIP Users
IN BR
(function executeRule(current, previous /*null when async*/ ) {
    // Add your code here
    var arrEmail = [];
    var gr = new GlideRecord('sys_user');
    gr.addQuery('vip', true);
    gr.query();
    while (gr.next()) {
        arrEmail.push(gr.sys_id.toString());
    }
    gs.log("arrEmail = " + arrEmail);
    gs.log("current.assigned_to.email = " + current.assigned_to.email);
    gs.eventQueue('emergency.change', current, arrEmail);
})(current, previous);Add this code
And in Notification pls do below thing
You have to check true to this parm 1 and parm 2 variable
Result
I have this 3 user is VIP and if we check the Email logs
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
