How to Trigger the SLA from workflow only and does not trigger like normal SLA Definition works

varshajain
Tera Expert

I create one SLA definition and want to trigger it through workflow only . But it trigger it from SLA definition , want to make it disable .
and to trigger SLA from workflow, I follow these script but it didn't work

(function() {
    var slaDefinitionId = '39701a5b3b7ba214b179dd24c3e45a14'; // Replace with actual SLA Definition sys_id
   
    var controller = new TaskSLAController(current);

    // Start the SLA
    controller.startSLA(slaDefinitionId);

    gs.info("SLA manually triggered for record: " + current.getDisplayValue());
})();


9 REPLIES 9

Kieran Anson
Kilo Patron

startSLA isn't a function of TaskSLAController. What's the reason for wanting to trigger an SLA based on a workflow step rather than conditionally? With the added context, we may be able to offer a better solution

As because based on multiple conditions , I want to trigger SLA  and those  conditions can't be possible in SLA definitions.
Can you suggest me the script to SLA Trigger from workflow. ? 

SLA definitions support multiple conditions. You can also SLA condition rules which allow you to use a script include to decide when to start,pause,stop, and reset SLAs

https://www.servicenow.com/docs/csh?topicname=c_SLAConditionRules.html&version=latest 

The conditions are more complex, as it also based on most of workflow activities result.
To use script include it becomes more complex.
I found all conditions through workflow easily and connections are also easily working in workflow . Is there no way to trigger it through workflow ?