
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 08-03-2018 01:13 AM
Use Case:
It may happen that you would like to create any SLA or OLA automatically when, let's say any group is created (to automate the process of Service Level Mgmt definition).
For doing a case above, there might be useful to create a business rule on the sys_user_group table with the glide query on the contract_sla table.
Specification:
When: After
Insert: True
Advanced: True
In such a scripted business rule the most important is how to appropriately refer to Start conditions. Namely, it requires providing the string "collection=table_name".
Exemplary code may look like :
(function executeRule(current, previous /*null when async*/) {
var ola = new GlideRecord('contract_sla');
ola.initialize();
ola.name = "P1 " + current.name + " for all incs with Priority = 1"; //is setting contract name
ola.target = 'Resolution';
ola.setValue('start_condition','priority=1^assignment_group=Service Desk^EQ^collection=incident'); //is setting OLA conditions
ola.type = 'OLA';
ola.setValue('duration',gs.getDurationDate('0 1:0:0')); //is setting OLA duration
ola.schedule = '8-5 weekdays'; //OLA schedule
ola.insert();
Then, once you create a new group, it will automatically create a new OLA definition like this:
- 3,855 Views