OnCallContactPrefTemplate - Global
On this page
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.
|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.<table id=“table_dgl_2rd_3xb” class=“returns”><thead><tr><th>
Type
</th><th>
Description
</th></tr></thead><tbody><tr><td>
Object
</td><td>
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" }
</td></tr><tr><td>
<Object>.error
</td><td>
Error 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
</td></tr><tr><td>
<Object>.warning
</td><td>
Warning message.Data type: String
</td></tr></tbody> </table>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 NoneThis example deletes all contact preferences associated with the Service Desk – Default escalation set.
var escSetSysId = "a47ac1abeb5a6110249e8d835d5228aa"; var contactPrefTemp = new global.OnCallContactPrefTemplate(); contactPrefTemp.deleteContactPreferenceAttempts(escSetSysId);
Keep exploring.
Find another answer, or bring this documentation into your own tools.