We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Two Duplicate SLA defintions on a single catalog task

shahiedsali
Tera Expert

Hello Community,

 

I have configured a SLA condition rule for a SLA definition on the sc_task table. I configured the attach() function and it started the SLA task on sc_task record. But it is having duplicates of the same SLA Definitions on the sc_task record. They are created 2 seconds apart. Any help will be greatly appreciated.

 

Thank you.

 

 

3 REPLIES 3

sandeepdutt
Tera Patron

Hi @shahiedsali ,

Wrap it so it only fires if there isn't already an active (or any) task_sla for that definition on that task and never call attach() unconditionally. Please check the below example :

(function() {
    var slaDefSysId = 'PUT_YOUR_SLA_DEFINITION_SYS_ID_HERE';

    var gr = new GlideRecord('task_sla');
    gr.addQuery('task', current.sys_id);
    gr.addQuery('sla', slaDefSysId);
    gr.query();

    if (!gr.hasNext()) {
        attach();
    }
})();
Thanks,
Sandeep Dutta

Please mark the answer correct & Helpful, if i could help you.

SD_Chandan
Kilo Sage

Hi @shahiedsali 

Review all Business Rules, Flows, and SLA conditions on the sc_task table and ensure the SLA is attached only if an active SLA record for the same definition does not already exist.

Thank you
Chandan

Tanushree Maiti
Tera Patron

Hi @shahiedsali 

  • Use distinct conditions (Like assignment group etc) for each definition. Verify that "Allow Multiple" is unchecked if you only want one instance of a specific definition on a task
  • Add current.setWorkflow(false); in your custom Business Rule or script prior to updating the sc_task record. This prevents the standard "Run SLAs" Business Rule from simultaneously firing

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti