Awaiting User Info - Inactivity Monitor and Email trigger - Not Working

marcink
Kilo Explorer

Hi all.

I am trying to setup an inactivity monitor for incidents that are in Awaiting USer info for lnger than a day and then trigger notification emails to be send to the caller each day untill they provide an update.

I have searched this forums and tried applying what i found to no avail, see below what i setup - could anyone point me in the right direction of what am I missing ?

Inactivity Monitor:

find_real_file.png

Email Notifications:

find_real_file.png

find_real_file.png

find_real_file.png

 

Business Rule:

find_real_file.png

I have only set the When to Run, but i cannot figure out what to put in actions tab as I only have below available:

find_real_file.png

 In Scheduled Jobs i can see activity monitor Running and after checking some it looks for state "awaiting user info" but includes other teams not Business Inteligence as requested. But i cannot see any emails being fired. Not sure what it does at this point other than checking ?

find_real_file.png

I also required that this System update prompt is added onto the incident for visibility.

Any pointers will be welcome - please dont send me to Wiki as i have gone through this:

https://community.servicenow.com/community?id=community_blog&sys_id=956daa29dbd0dbc01dcaf3231f9619cb

https://docs.servicenow.com/bundle/jakarta-platform-administration/page/administer/time/task/t_SetAn...

https://community.servicenow.com/community?id=community_question&sys_id=62e603e5db1cdbc01dcaf3231f96...

This last one i followed with exception to auto resolving and this still won't do it ?;/

 

Thanks in advance.

1 ACCEPTED SOLUTION

johnfeist
Mega Sage
Mega Sage

Hi marcink,

I have a similar situation and resolved it via a different approach.  Let's take the basic case that once a day you will send a dunning notice to the assignee on any incident that hasn't been updated in a day or more.

I don't use any BRs.  Rather I use a script like this:

sendNotice : function() {
    var rightNow = new GlideDateTime();
    rightNow.addDaysLocalTime(-1);  //you may want to use UTC time, check the documentation
    var theGroup = new GlideRecord("sys_user_group");
    theGroup.get("name","Business Intelligence");
    var theIncidents = new GlideRecord("incident");
    theIncidents.addQuery("sys_updated_on", "<", rightNow);
    theIncidents.addQuery("state", 3); //on hold
    theIncidents.addQuery("hold_reason", 1); //This is awaiting caller
    theIncidents.addQuery("assignment_group"," theGroup.sys_id); 
    theIncidents.query();
    var incidentCount = theIncidents.getRowCount(); //this isn't necessary but useful when debugging
    while (theIncidents.next()){
	gs.eventQueue("<notification name>", theIncidents, theIncidents.number, theIncidents.assigned_to);
    }
},

I may have done a little fat fingering when setting up the above, but the code works for me.  You can check in the dictionary for On Hold reason for the correct reason.

Have your notification set up to be triggered by whatever event you define and assign the two params as needed.

When you set up your job all you need is the following in run this script

var zot = new <your script name>();
zot.<your function name>();

To post a notice (addErrorMessage() to put it in red), you can put a script in a UI policy or an load client script based on the logic in the function.

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

 

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

View solution in original post

6 REPLIES 6

johnfeist
Mega Sage
Mega Sage

Hi marcink,

I have a similar situation and resolved it via a different approach.  Let's take the basic case that once a day you will send a dunning notice to the assignee on any incident that hasn't been updated in a day or more.

I don't use any BRs.  Rather I use a script like this:

sendNotice : function() {
    var rightNow = new GlideDateTime();
    rightNow.addDaysLocalTime(-1);  //you may want to use UTC time, check the documentation
    var theGroup = new GlideRecord("sys_user_group");
    theGroup.get("name","Business Intelligence");
    var theIncidents = new GlideRecord("incident");
    theIncidents.addQuery("sys_updated_on", "<", rightNow);
    theIncidents.addQuery("state", 3); //on hold
    theIncidents.addQuery("hold_reason", 1); //This is awaiting caller
    theIncidents.addQuery("assignment_group"," theGroup.sys_id); 
    theIncidents.query();
    var incidentCount = theIncidents.getRowCount(); //this isn't necessary but useful when debugging
    while (theIncidents.next()){
	gs.eventQueue("<notification name>", theIncidents, theIncidents.number, theIncidents.assigned_to);
    }
},

I may have done a little fat fingering when setting up the above, but the code works for me.  You can check in the dictionary for On Hold reason for the correct reason.

Have your notification set up to be triggered by whatever event you define and assign the two params as needed.

When you set up your job all you need is the following in run this script

var zot = new <your script name>();
zot.<your function name>();

To post a notice (addErrorMessage() to put it in red), you can put a script in a UI policy or an load client script based on the logic in the function.

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

 

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Hi John.

As i said below  very little scripting skills. I assume i need to add this into Scheduled Job script ? If yes im presented with below errors:

In refference to running the second script - can you advise where to add this and run ?

 

Thanks in advance.

Okay, here's how you do it.  Start out by opening System Definition | Script Includes.  Then hit the new button.  You'll get a screen that looks like this:

find_real_file.png

When it first comes up Name, API Name, Description and Script will be empty.  When you give it a name and move onto the description the API Name and basic script will appear.  For this you don't need it to be client callable.  Don't worry about the items on the top right, just make sure you leave Active checked.

Copy the larger script that I sent into the framework like this.

find_real_file.png

Don't worry about the grey in the image, I just had everything selected.  Be sure that you have the comma above type:  There was an extra " on line 14 between "assignment_group", and theGroup.  Taking that out will clear the red and yellow bubbles.

When you set up your runs script, it will be:

var script = new DealWithDeliquints();
script.sendNotice();

That should give you what you need.

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Ian Mildon
Tera Guru

And I took a different approach and am using a workflow to handle all the 'workload' of timers, update checks, email notifications and ultimately, automated resolution of the Incident.