SLARepair - Global
The SLARepair API first deletes the existing SLAs and then recreates them from each task's history.
SLARepair - repairByFilter(String filter, String sourceTable)
Repair the task SLAs associated with the passed-in filter and source table.
| Name | Type | Description |
|---|---|---|
| filter | string | Specify an encoded query that is used to retrieve a set of records from the source table. |
| sourceTable | string | Specify the name of a table that is (or extends) contract_sla, task_sla, or task. |
| Type | Description |
|---|---|
| void |
Repair SLAs for problems created last month with a priority of 2.
var now_GR = new GlideRecord("problem");
now_GR.addQuery("sys_created_on", "ON", "Last Month@javascript:gs.beginningOfLastMonth()@javascript:gs.endOfLastMonth()");
now_GR.addQuery("priority", "2");
now_GR.query();
var repair = new SLARepair();
while (now_GR.next())
repair.repairByFilter(now_GR.getEncodedQuery(), now_GR.getRecordClassName());
SLARepair - repairByGlideRecord(GlideRecord now_GR)
Repair the task SLAs associated with the passed in GlideRecord.
| Name | Type | Description |
|---|---|---|
| now_GR | GlideRecord | Specify a GlideRecord for a table that is (or extends) contract_sla, task_sla, or task. |
| Type | Description |
|---|---|
| void |
Repair SLAs for problems created last month with a priority of 2.
var now_GR = new GlideRecord("problem");
now_GR.addQuery("sys_created_on", "ON", "Last Month@javascript:gs.beginningOfLastMonth()@javascript:gs.endOfLastMonth()");
now_GR.addQuery("priority", "2");
now_GR.query();
var repair = new SLARepair();
while (now_GR.next())
repair.repairByGlideRecord(now_GR);
SLARepair - repairBySysId(String sysId, String sourceTable)
Repair the task SLAs associated with the passed in sys_id and source table.
| Name | Type | Description |
|---|---|---|
| sysId | string | Specify the ID of a table that is (or extends) contract_sla, task_sla, or task. |
| sourceTable | string | Specify the name of a table that is (or extends) contract_sla, task_sla, or task. |
| Type | Description |
|---|---|
| void |
Find problems created last month with a priority of 2
var now_GR = new GlideRecord("problem");
now_GR.addQuery("sys_created_on", "ON", "Last Month@javascript:gs.beginningOfLastMonth()@javascript:gs.endOfLastMonth()");
now_GR.addQuery("priority", "2");
now_GR.query();
var repair = new SLARepair();
while (now_GR.next())
repair.repairBySysId(now_GR.sys_id + "", now_GR.getRecordClassName());
SLARepair - setAuditEnabled(Boolean onOrOff)
Enables or disables auditing when running a repair.
By default, auditing is set to the value in the property com.snc.sla.repair.audit. You can override this with passing in true to enable or false to disable auditing.
| Name | Type | Description |
|---|---|---|
| onOrOff | Boolean | Determines whether to enable or disable auditing. |
| Type | Description |
|---|---|
| this | A self-reference to allow for method chaining. |
var builder = new SLARepair();
builder.setAuditEnabled(true);
SLARepair - setRunWorkflow(Boolean onOrOff)
Enables or disables running a workflow for each of the Task SLA records being repaired.
By default, when a Task SLA is repaired the workflow will be run during the repair process. To override this, you can pass in false to disable running of the workflow or true to enable it.
| Name | Type | Description |
|---|---|---|
| onOrOff | Boolean | Determines whether to enable or disable workflow. |
| Type | Description |
|---|---|
| this | A self-reference to allow for method chaining. |
var repair = new SLARepair();
repair.setRunWorkflow(false);
SLARepair - setValidateOnly(Boolean onOrOff)
Validates the repair request.
If false is passed in, the task SLAs will be repaired. If true is passed in, calls to repair will not alter any task SLAs but only validate the supplied parameters and generate a count of records to be repaired.
| Name | Type | Description |
|---|---|---|
| onOrOff | Boolean | Determines whether to enable or disable validation. |
| Type | Description |
|---|---|
| this | A self-reference to allow for method chaining. |
var repair = new SLARepair();
repair.setValidateOnly(true);