SLA's on REQ, RITM or SCTASK

steve_turley
Tera Contributor

Is there a best practice for where the 'Request' SLA should be located? 

 

We have a requirement to have a standard Request SLA for any Request Item. However, what it must do is pause when any of the linked SCTASKS are in a 'pending' state and then restart when none of the linked SCTASKS are pending.

 

We've attempted this using business rules but it has caused problems with Items with multiple tasks.

 

Thanks!

 

 

5 REPLIES 5

@steveturley 

 

Below script should make the pause flag as false as well.

 

//Assuming pending date value as 6, verify the same

var grReq = new GlideRecord("sc_req_item");

if(current.state == "6"){

	grReq.addQuery("sys_id", current.request_item);

	grReq.query();

	if(grReq.next()){

		grReq.SLA_PAUSED_FIELD_NAME = true;

		grReq.update();

	}

}

else{

	var grTask = new GlideRecord("sc_task");

	grTask.addQuery("request_item",current.request_item);

	grTask.addQuery("state","6");

	grTask.setLimit(1);

	grTask.query();

	if(grTask.next){

		grReq.addQuery("sys_id", current.request_item);

		grReq.query();

		if(grReq.next()){

			grReq.SLA_PAUSED_FIELD_NAME = true;

			grReq.update();

		}else{

			grReq.addQuery("sys_id", current.request_item);

			grReq.query();

			if(grReq.next()){

				grReq.SLA_PAUSED_FIELD_NAME = false;

				grReq.update();

			}

		}

	}
	else{
		grReq.addQuery("sys_id", current.request_item);

			grReq.query();

			if(grReq.next()){

				grReq.SLA_PAUSED_FIELD_NAME = false;

				grReq.update();

			}
	}

}
If I could help you with your Query then, please hit the Thumb Icon and mark my answer as Correct!!

Thank you,
Ali