The CreatorCon Call for Content is officially open! Get started here.

Can I use a script include as an SLA stop condition?

robhumphries
Kilo Expert

Hi,

 

I have a script include I have used to filter the task list eg. sys_id is javascript:assignedIsGroupManager()

 

Can I use this same filter on an SLA stop condition? I have tried it by entering the same on the SLA definition but it is not having the desired effect.

 

Am I missing something?

 

Thanks

 

Rob

1 ACCEPTED SOLUTION

edwajs
ServiceNow Employee
ServiceNow Employee

The short answer is no, this feature is not currently available for SLA Condition processing.



From an architecture standpoint, the conditions work this way:


  1. When you specify a condition in the SLA Definition, you use the filter builder to construct an encoded query.
  2. When the SLA Engine does it's condition checking, it does it by executing the encoded query for a single task record:
    • i.e., WHERE <encoded query> AND sys_id returns a record, the condition is true; if nothing is returned, the query is false.


And the script processing you want as a filter condition (like for a reference qualifier) needs to be done as a pre-processing step, to generate the final encoded query.



You might want to try the following method to implement this:


a. Create a custom field to hold your script include return result: for example, u_my_condition true/false


b. Create a before-insert business rule to evaluate your script include function and store the result in your custom field.


c. Add your custom field to the desired SLA Condition:   AND u_my_condition is true



Ed Wajs


ServiceNow Technical Support


View solution in original post

3 REPLIES 3

edwajs
ServiceNow Employee
ServiceNow Employee

The short answer is no, this feature is not currently available for SLA Condition processing.



From an architecture standpoint, the conditions work this way:


  1. When you specify a condition in the SLA Definition, you use the filter builder to construct an encoded query.
  2. When the SLA Engine does it's condition checking, it does it by executing the encoded query for a single task record:
    • i.e., WHERE <encoded query> AND sys_id returns a record, the condition is true; if nothing is returned, the query is false.


And the script processing you want as a filter condition (like for a reference qualifier) needs to be done as a pre-processing step, to generate the final encoded query.



You might want to try the following method to implement this:


a. Create a custom field to hold your script include return result: for example, u_my_condition true/false


b. Create a before-insert business rule to evaluate your script include function and store the result in your custom field.


c. Add your custom field to the desired SLA Condition:   AND u_my_condition is true



Ed Wajs


ServiceNow Technical Support


Thanks Ed,



I'll give the custom field solution a go



Cheers



Rob


You can also look into custom SLA Condition rules: SLA condition rules