Notifications to be triggered when the Incident state is on hold and on hold reason is awaiting user?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 04:11 AM
Hello All,
I have an urgent requirement, when the incident state kept on hold and on hold reason is awaiting user, if the caller doesn't respond at all, notifications have to be triggered as below:
1st notification to be sent after 5 days of state is on hold
2nd notification to be sent after 9 days of state is on hold
Incident should get closed automatically on the 10th day.
if the caller responds in between or changes the state to work in progress, the above should abort(stop)..no longer send notifications.
Please do needful.
Quick response is highly appreciated.
Regards,
K
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-10-2019 05:00 AM
Hi Kaylan,
I've had a similar need. What you want is either a workflow or flow designer flow. The flow is started when the incident is set to on hold awaiting user. From there, you go to a wait for block that is looking to see either that the five days have passed or that there has been an update.
If the time has expired, trigger a notice. If there has been an update and the state is unchanged, rollback to starting the timer.
The same would apply after sending the first notice. Wait for an update, or time expired. If time has again expired, one more wait for and if still no action, your final box is to resolve the incident.
In all cases, if there is a change of state to in progress, the flow terminates.
I do have to question, why you are letting callers change the state directly?
Hope that helps.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2019 01:21 AM
1] Make one custom field name as 'state update'
2] Write a business rule on incident table using condition 1] state--changes to--onHold and on hold reason--changes to-- Awaiting Caller on after insert or update
current.u_state_update=gs.nowDateTime();
current.update();
3] Write a Scheduled Job to trigger the mails on conditions
var daysdiff;
var inc=new GlideRecord('incident');
inc.addQuery('u_state_update','!=',' ');
inc.query();
while(inc.next())
{
var diff= GlideDateTime.subtract(new GlideDateTime(inc.u_state_update),new
GlideDateTime(gs.nowDateTime())); //u_state_update is a db name of state
update field
daysdiff= diff.getDayPart();
if(daysdiff>5)
{
gs.log('5 days');
gs.eventQueue('notification to be sent after 5 days',inc,inc.caller_id);
}
else if(daysdiff>9)
{
gs.log('9 days');
gs.eventQueue('notification to be sent after 9 days',inc,inc.caller_id);
}
else if(daysdiff>10)
{
gs.log('10 days');
inc.state='7';
inc.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2020 09:15 AM
My suggestion is to use flow designer to achieve this. Advantage of doing this in flow designer is you dont have to write script in schedule job and no need to create extra field on the form to hold the date time when the incident was put on hold and it'll be more effective than a scheduled job and easier to configure.