Business Rule To Release An Incident From On-Hold State Is Not Causing The SLA To Resume

richardd
Mega Contributor

In my SLA I have a pause condition for tickets that are on-hold.

I have created a business rule so that when a client provides an update to the ticket it updates the State field from On-Hold to Open. This is working successfully however the SLA should no longer be in a Paused state.

If I  manually update the state from On-Hold to Open the SLA resumes as expected.

Is there another update required in the business rule to force the SLA to resume?

1 ACCEPTED SOLUTION

Hi Richard,



I tried the following:



* Client script: when a user inserts a comment, set state to 'in progress'   [ You may use a different condition ]


Type: onSubmit


function onSubmit() {


  if(g_form.modified){


  var ad_comments = g_form.getControl('comments');


  if (ad_comments.changed) {


  g_form.setValue('state','2');


  }


  }


}


*SLA:


- Table: incident


- Start condition: status is "on hold"


- Pause condition: status is "in progress". When to resume: "Pause conditions are not met"


- Stop condition: status is "resolved" or "closed"



This worked for me as expected: when I entered a new comment, state was set to "in progress" and SLA's moved to "In Pause"


Anyway, as maybe your script logic is more complicated than my tests, I would recommend you to put the code I provided in my last post at the end of the BR "Run SLAs", so the workflow will be updated after SLA's have been updated too. This should not very heavy in terms of performance.



Cheers,


Javier


View solution in original post

6 REPLIES 6

lorisd_avanzo
ServiceNow Employee
ServiceNow Employee

Hi,



That's strange actually, there are several possible causes for this unexpected behavior:



1. The order of your customized Business Rule you have created is higher than 101 (which is the order of the Process SLAs Business Rule). Because of this, your update to the State is evaluated after calculating the Task SLA. In this case, the solution would be using a lower Order value in your customized Business Rule.



2. Some other updates to different fields are causing the Task SLA to be still in the Paused stage.


For troubleshooting this, I would suggest you to have a look at the history of the record, and then check the actual updates along with your SLA Definition.


The KB article number KB0598456 may help as well, in particular the table in the section 9 (rows: "An SLA will pause when...", "An SLA will resume when...").



In case you need additional assistance, please provide a screenshot of the record history/SLA Definition/Business Rule, I will try to have a look at them for you.



Regards,


Loris D'Avanzo


Loris,



Thanks for your feedback.



Regarding point 1:


I set the business rule to be the first one to execute when I encountered this with no effect.



Regarding point 2:


There are no other updates happening as part of the update, and the only condition on the pause condition is regarding the state being 'On=-Hold'



I will try to add screenprints later.



Richard


javier_messeri
Kilo Expert

Hi Richard,



You have to take into account that, when manually "forcing" an SLA to update(i.e. by scripting), you should also manually refresh your workflow to make it "realize" about this.


Maybe you can try by adding to your BR a piece of code similar to:



var current_record = new GlideRecord('task');


current_record.get('sys_id', current.sys_id);


var wf = new Workflow();


wf.runFlows(current_record, 'update');



Let me know if this helps


Cheers,



Javier


Javier,



Thanks for the feedback,I have tried that code but the symptoms are still persisting.



The relevant code now looks like this:



if (previous.state == 4 && util.isLoggedInUserSuperUser()) {


        current.state = 2;     // state 2 = Open



        var current_record = new GlideRecord('task');


        current_record.get('sys_id', current.sys_id);


        var wf = new Workflow();


        wf.runFlows(current_record, 'update');


}



Richard