Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

SLA start condition based on time

Lucien1
Giga Expert

Hi all,

I have a requirement to measure a vendors SLAs and have come into a bit of a problem. the criteria is as follows

1. They have 2 sets of SLA hours: Core hours are 07:00 - 19:00 and have a 30 minute response SLA. 19:00 - 07:00 and have a 45 minute response SLA

2. They always the team that create the incidents so I need to build this on the basis on when we assign them the incidents.

When I assign them an incident, both SLAs attach but only 1 clock runs.

What I am trying to achieve is that the SLAs only get attached to the incident if the incident is assigned to them during the set hours. 07:00 - 19:00 OR 19:00 - 07:00

Has anyone done this? If so, how did you get this working and can you share it.

Thanks all for your help.

1 ACCEPTED SOLUTION

I tried this and it worked:



(function executeRule(current, previous /*null when async*/) {


      var schedRec = new GlideRecord('cmn_schedule');


      schedRec.get('name', '8-5 Weekdays');


      gs.addInfoMessage('Checking against schedule: ' + schedRec.sys_id);


      var sched = new GlideSchedule(schedRec.sys_id);


     


      if(sched.isInSchedule(new GlideDateTime())){


              gs.addInfoMessage('in schedule');


              current.u_business_hours = 'true';


      }else{


              gs.addInfoMessage('not in schedule');


      }


     


})(current, previous);


View solution in original post

5 REPLIES 5

No problem, glad it work.