Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

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).

Parent Topic:Server API reference

OnCallContactPrefTemplate - OnCallContactPrefTemplate()

Instantiates an OnCallContactPrefTemplate object.

NameTypeDescription
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.

NameTypeDescription
templateSysIdStringSys_id of the contact preference template in the On-Call Contact Preference Template [on_call_template_contact_preference] table.
escalationSetSysIdStringSys_id of the escalation set in the Shift Escalation Set [cmn_rota_escalation_set] table.
TypeDescription
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.

{ "error": "String", "warning": "String" }

<Object>.errorError message.Possible values: - Contact preference template sys\_id is not correct - Escalation set sys\_id is not correct - Contact attempts exist already Data type: String
<Object>.warningWarning 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.

NameTypeDescription
escalationSetSysIdStringSys_id of the escalation set in the Shift Escalation Set [cmn_rota_escalation_set] table.
TypeDescription
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);