how to create SLA has breached by script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-31-2022 10:44 PM
MY requirement is in SLA using Workflow.
i am creating an sn_customerservice_task
. when ever sn_customerservice_task is created SLA should run for 24 hours.
if the SLA has breached , the notification should be sent.
i have created an code to check the task is breached , but it is not working
answer = ifScript();
var gr = new GlideRecord('task_sla');
gr.addQuery('task', sys_id);
gr.addQuery('has_breached', true);
gr.query();
function ifScript() {
if (gr.sla.type == 'sn_customerservice_task') {
return 'yes';
}
return 'no';
}
send me the updated script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 12:50 AM
Few things needs to be clear.
If workflow is interaction table. Is there any field in interaction table which references to case or case task. We need at-least 1 field in interaction table to refer to case or case task to be able to do this.
Best and easiest thing to do is to modify the workflow assigned for the SLA it will have a notification activity after SLA is breached. MOdify the workflow selected in the highlighted field of the SLA definition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 01:34 AM
I have given the interaction table in workflow , becuse im getting the value from the inbound actions and i am getting the interaction field value to copy to case tbale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 02:46 AM
But the workflow should run on task_sla table. Change the table in workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-01-2022 02:51 AM
Below should be the script of workflow running on task_sla table
answer = ifScript();
function ifScript() {
if (task.sys_class_name == "sn_customerservice_task")
{
if (current.has_breached.toString() == 'true'){
return 'yes';
}
return 'no';
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-31-2022 10:58 PM
Hi,
Would you mind closing your earlier questions as answered if you were able to resolve it?
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader