OnCallContactPrefTemplate - Global
The OnCallContactPrefTemplate script include provides methods to apply contact preference templates to escalation sets.
For more information about the escalation process, see Defining On-Call Scheduling escalation process.
This script include requires the On-Call Scheduling plugin (com.snc.on_call_rotation).
OnCallContactPrefTemplate - OnCallContactPrefTemplate()
Instantiates an OnCallContactPrefTemplate object.
| Name | Type | Description |
|---|---|---|
| None |
This example instantiates an OnCallContactPrefTemplate object.
var contactPrefTemp = new global.OnCallContactPrefTemplate();
OnCallContactPrefTemplate - copyContactPreferences(String templateSysId, String escalationSetSysId)
Applies a contact preference template to an escalation set.
When the template is applied to the escalation set, contact attempt records are created in the Shift Contact Preference [cmn_rota_contact_preference] table.
Before calling this method, call the deleteContactPreferenceAttempts() method to delete existing contact attempt records. If existing records are not deleted first, this method returns an error.
| Name | Type | Description |
|---|---|---|
| templateSysId | String | Sys_id of the contact preference template in the On-Call Contact Preference Template [on_call_template_contact_preference] table. |
| escalationSetSysId | String | Sys_id of the escalation set in the Shift Escalation Set [cmn_rota_escalation_set] table. |
| Type | Description |
|---|---|
| Object | Object containing error and warning messages. If the operation was successful, this object is empty.
Note: If an error occurs, the operation stops and the template is not applied. If a warning occurs, the
operation continues and some records are still created. |
| <Object>.error | Error message. Possible values:
Data type: String |
| <Object>.warning | Warning message. Data type: String |
This example applies a contact preference template to the Service Desk – Default escalation set. The return object is empty because there are no errors or warnings.
var escSetSysId = "a47ac1abeb5a6110249e8d835d5228aa";
var templateSysId = "f8dac9ebeb5a6110249e8d835d522873";
var contactPrefTemp = new global.OnCallContactPrefTemplate();
// delete existing contact attempt records before applying the template
contactPrefTemp.deleteContactPreferenceAttempts(escSetSysId);
var result = contactPrefTemp.copyContactPreferences(templateSysId, escSetSysId);
gs.info(JSON.stringify(result));
Output:
{}
OnCallContactPrefTemplate - deleteContactPreferenceAttempts(String escalationSetSysId)
Deletes all contact preferences associated with an escalation set.
All contact attempt records for the escalation set are deleted from the Shift Contact Preference [cmn_rota_contact_preference] table.
| Name | Type | Description |
|---|---|---|
| escalationSetSysId | String | Sys_id of the escalation set in the Shift Escalation Set [cmn_rota_escalation_set] table. |
| Type | Description |
|---|---|
| None |
This example deletes all contact preferences associated with the Service Desk – Default escalation set.
var escSetSysId = "a47ac1abeb5a6110249e8d835d5228aa";
var contactPrefTemp = new global.OnCallContactPrefTemplate();
contactPrefTemp.deleteContactPreferenceAttempts(escSetSysId);