- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2016 12:32 PM
Requirement is to have a new 30 min response SLA created whenever the assignment group changes on the incident. The previous should get closed and the new one should be created. How to design SLA definition to achieve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2016 09:14 AM
A small correction. Instead of a client script, I am using a BR instead.
So here is the complete code:
STEP 1: Create following new fields on Incident table:
- 'Response SLA State' (u_response_sla_state) string field.
- 'Trigger Group' (u_trigger_group) reference field to groups.
STEP 2: Create Response SLA definition as below:
STEP 3: Create BEFORE UPDATE business rule on incident table as below:
Code:
function onBefore(current, previous) {
//This function will be automatically called when this rule is processed.
current.u_trigger_group = previous.assignment_group;
current.state = 1;
var gr = new GlideRecord("task_sla");
gr.addQuery("task", current.sys_id);
gr.addQuery("sla", "<sys_id of the SLA Definition record above>");
gr.addQuery("stage","NOT IN","cancelled,completed");
gr.query();
if (gr.next()) {
current.u_response_sla_state = 'complete';
} else {
current.u_response_sla_state = 'create';
}
}
STEP 4: Create BEFORE INSERT/UPDATE business rule on task_sla table as below:
Code:
function onBefore(current, previous) {
//This function will be automatically called when this rule is processed.
var task_id = current.task;
var gr = new GlideRecord("incident");
gr.get(task_id);
gr.u_response_sla_state = 'create';
gr.update();
}
This should make it work.
- Hardik Vora
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2016 02:02 PM
Tried it. With this condition it did not even create an SLA task.
- Hardik Vora
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2016 07:07 PM
Did you find an answer to this one?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2016 02:23 PM
Yes, I created a workaround solution.
I customized the Incident form to store the flag. When a new incident is created, the flag is set to 'create' (which indicates that SLA should be created).
On Assignment Field onchange client script, i change the flag to 'complete'.
In SLA definition, my start condition is checking flag == create
stop condition is flag == complete.
As the flow goes, whenever the parent record is updated, the SLAs tagged to it are ran for calculation. The magic here lies in the way the SLA conditions are matched. In this scenario, the current in-progress SLA will be completed. And as soon as the incident record is updated, the new SLA record will be created.
- Hardik Vora
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 02:57 AM
Hi hardik,
What if the assignment group changes multi times? still does this process holds good?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 08:32 AM
Yes, it does. So you steps in that case would be:
1. On Assignment Field onchange client script, i change the flag to 'complete'.
2. In SLA definition, my start condition is checking flag == create
stop condition is flag == complete.
3. onBefore BR on SLA Task table to update the incident flag again to 'create'.