Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Email notification to team

Sharath807
Tera Contributor

Hi all, so how to trigger a  Mail notification to respective support team 1 or  support team 2, when incident is pending with "Inactive" members.

1 ACCEPTED SOLUTION

Rohit99
Mega Sage

Hi @Sharath807 ,

 

Create Event as Follows:

mail_script_01.PNG

 

To work on past/existing records you may write fix script as follows:

 

var gr = new GlideRecord('incident');
gr.addEncodedQuery('active=true^assigned_toISNOTEMPTY')
gr.query();
while(gr.next())
{
if(gr.assigned_to.active == false)
{
gs.eventQueue('Inactive User Notification', gr , gr.number, gr.short_description); 
}
}

 

For further inactivation of users you may write business rule as follows:

Type : before->Update

condition: active -> changes to -> false

script:

var gr = new GlideRecord('incident');
 gr.addQuery('assigned_to',current.sys_id);
   gr.query();
    while(gr.next())
    {
        gs.eventQueue('Inactive User Notification', gr , gr.number, gr.short_description);
    }
Now you can write the notification and in when to send field select event is fired.
 

Please mark my response as correct and helpful if it helped solved your question.

 

Thanks,

Rohit Suryawanshi

View solution in original post

13 REPLIES 13

Not applicable

I don't have access to my laptop today.  Will provide tomorrow 

Not applicable

Rohit's solution will work. Thanks.

Rohit99
Mega Sage

Hi @Sharath807 ,

 

Create Event as Follows:

mail_script_01.PNG

 

To work on past/existing records you may write fix script as follows:

 

var gr = new GlideRecord('incident');
gr.addEncodedQuery('active=true^assigned_toISNOTEMPTY')
gr.query();
while(gr.next())
{
if(gr.assigned_to.active == false)
{
gs.eventQueue('Inactive User Notification', gr , gr.number, gr.short_description); 
}
}

 

For further inactivation of users you may write business rule as follows:

Type : before->Update

condition: active -> changes to -> false

script:

var gr = new GlideRecord('incident');
 gr.addQuery('assigned_to',current.sys_id);
   gr.query();
    while(gr.next())
    {
        gs.eventQueue('Inactive User Notification', gr , gr.number, gr.short_description);
    }
Now you can write the notification and in when to send field select event is fired.
 

Please mark my response as correct and helpful if it helped solved your question.

 

Thanks,

Rohit Suryawanshi

Hi @Sharath807 ,

Have you tried the given solution ?


Please mark my response as correct and helpful if it helped solved your question.

 

Thanks,

Rohit Suryawanshi