--- title: CMDBDuplicateTemplateUtil - Global description: The CMDBDuplicateTemplateUtil script include provides methods to add and remove de-duplication tasks to/from a de-duplication template.Creates an instance of the CMDBDuplicateTemplateUtils class.Adds one or more de-duplication tasks to a specified de-duplication template.Clears the de-duplication template value in the specified de-duplication task records. By clearing this value, the association between a template and the task is removed. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/api-reference/server-api-reference/CMDBDuplicateTemplateUtilAPI.html release: australia product: Server API Reference classification: server-api-reference topic_type: concept last_updated: "2026-03-12" reading_time_minutes: 4 breadcrumb: [Server API reference, API reference, API implementation and reference] --- # CMDBDuplicateTemplateUtil- Global The CMDBDuplicateTemplateUtil script include provides methods to add and remove de-duplication tasks to/from a de-duplication template. For more information on de-duplication of CIs, de-duplication tasks, and de-duplication templates, see [Duplicate CIs remediation](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/servicenow-platform/de-duplication-tasks.md). **Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md) ## CMDBDuplicateTemplateUtils - CMDBDuplicateTemplateUtils\(\) Creates an instance of the CMDBDuplicateTemplateUtils class. |Name|Type|Description| |----|----|-----------| |None| || The following code example shows how to call this method to create a CMDBDuplicateTemplateUtils object. ``` var dupTemp = new CMDBDuplicateTemplateUtils(); ``` ## CMDBDuplicateTemplateUtils - addTasksToTemplate\(String templateId, Array taskIds\) Adds one or more de-duplication tasks to a specified de-duplication template. This method overwrites any existing template values, but logs the previous values for each template in the system logs. The following list describes scenarios where a task isn’t added to a template and is then marked as either skipped or failed: - The specified template isn’t in the published state. All tasks are marked as skipped. - The specified template is running. All tasks are marked as skipped. - The task isn’t in the open state. The task is marked as skipped. - The task isn’t compatible with the specified template. For example, the specified template might be created for Application Server Tomcat, but the specified de-duplication task is created for Linux Server. The task is marked as skipped. - The specified template doesn’t exist. All tasks are marked as failed. - The GlideRecord update for the template column on the task fails. The task is marked as failed. |Name|Type|Description| |----|----|-----------| |templateId|String|Sys\_id of the de-duplication template to associate with the de-duplication task.| |taskIds|Array|List of sys\_ids of the de-duplication tasks to associate with the specified template.|
| Type | Description |
|---|---|
| Object | Result object containing the status of all the tasks that were attempted to be associated with the specified template.Data type: Object ``` { "failed": [Array], "skipped": [Array], "success": [Array], "summary": "String" } ``` |
| failed | List of tasks that failed to be associated with the template.Data type: Array of Objects ``` "failed": [ { "message": "String", "messageType: "String", "taskId": "String" } ] ``` |
| failed.message | Message that describes why the task failed to be associated with the template.Data type: String |
| failed.messageType | Reason for the failure.Data type: String |
| failed.taskId | Sys\_id of a task that failed to be associated with the template.Data type: String |
| skipped | List of tasks that didn't fail, but weren't associated with the template \(skipped\).Data type: Array of Objects ``` "skipped": [ { "message": "String", "messageType: "String", "taskId": "String" } ] ``` |
| skipped.message | Message that describes why the task was skipped.Data type: String |
| skipped.messageType | Reason for the task being skipped.Data type: String |
| skipped.taskId | Sys\_id of a task that the method skipped associated with the template.Data type: String |
| success | List of tasks that were successfully associated with the template.Data type: Array of Objects ``` "success": [ { "message": "String", "messageType: "String", "taskId": "String" } ] ``` |
| success.message | Not currently in use.Data type: String |
| success.messageType | Not currently in use.Data type: String |
| success.taskId | Sys\_id of a task that was associated with the template.Data type: String |
| summary | Brief description of any overall processing errors that occurred, such as if the specified template doesn't exist.Data type: String |
| Type | Description |
|---|---|
| Object | Result object containing the count of tasks for which the template value removal was successful, skipped, or failed. ``` { "failed": Number, "success": Number, "skipped": Number } ``` |
| failed | Number of tasks that failed to remove the de-duplication template value.Data type: Number |
| success | Number of tasks that successfully removed the de-duplication template value.Data type: Number |
| skipped | Number of tasks that the method skipped removing the de-duplication template value.Data type: Number |