- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 02:03 AM
To achieve this, I ran a Fix Script which executed successfully. Now, I want to create a Business Rule for future updates. I tried implementing it, but it's not working as expected.
I wrote an After Update Business Rule on the task_sla table with the following condition:
"Has Breached" changes to true AND Task starts with 'SCTASK'.
However, the logs show:
The task name is undefined
I also waited for the SLA to breach, but still there’s no output.
Could someone please help me review the Business Rule?
(function executeRule(current, previous /*null when async*/) {
// Only continue if the related task is of type sc_task
gs.addInfoMessage("hello");
var taskname = current.task.getDisplayValue();
gs.info("the task name is" +taskname);
// Get the most recent SLA record for the task
var scTask = new GlideRecord('sc_task');
scTask.addEncodedQuery('number='+taskname);
scTask.query();
if(scTask.next())
{
scTask.u_ticket_tat = current.has_breached;
gs.info("sc task has been updated" +scTask.u_ticket_tat);
scTask.update();
}
})();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 05:15 AM
Hi @sanasayyad
Change your Business rule condition & script as below
var scTask = new GlideRecord('sc_task');
scTask.get(current.task.sys_id);
scTask.u_ticket_tat = true;
scTask.update();
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 04:49 AM
please someone guide
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2025 05:15 AM
Hi @sanasayyad
Change your Business rule condition & script as below
var scTask = new GlideRecord('sc_task');
scTask.get(current.task.sys_id);
scTask.u_ticket_tat = true;
scTask.update();
Regards,
Siva