We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Discovery Duplicate remedy

ChittiS
Tera Expert

Hello Everyone, 
Can anyone please let me know how can I create De Duplicate Task manually?
Do I have write script for this?
Thanks

1 ACCEPTED SOLUTION

Hi @ChittiS ,


If the information provided was helpful, kindly mark it as helpful and accept the solution to close the thread for better community visibility.

 

Thanks,

Vishnu

 

View solution in original post

4 REPLIES 4

Vishnu-K
Tera Guru

Hi @ChittiS ,

 

It's better you create a Ui action for this 

use the following codes 

UI action:

function showConfirmationDialog() {
var entries = g_list.getChecked();
var sysIDs = entries.split(',');

var con1 = confirm('Total number of Selected CIs ' + sysIDs.length + '. Click OK to create De-duplicate task');

if (con1) {
alert(sysIDs);
var ga = new GlideAjax('createDuplicateCITask');
ga.addParam('sysparm_name', 'createDeDupTask');
ga.addParam('sysparm_entry_ids', entries);
ga.getXML(getDupTasks);
}

function getDupTasks(response) {

var answer = response.responseXML.documentElement.getAttribute("answer");
if (answer == null) {
alert('Failed to create Remediate Duplicate Task. Selected CIs are already part of an open Remediate Duplicate Task');
} else {
var url1 = 'reconcile_duplicate_task.do?sys_id=' + answer;
var con = confirm('The De-duplicate task is created. Click OK to redirect to De-duplicate task record');
if (con) {
location.href = url1;
}
}
}
}

Script include:
var createDuplicateCITask = Class.create();
createDuplicateCITask.prototype = Object.extendsObject(AbstractAjaxProcessor, {
createDeDupTask: function() {
var entries = this.getParameter('sysparm_entry_ids');

var dupTaskUtil = new CMDBDuplicateTaskUtils();
var deDupTaskID = dupTaskUtil.createDuplicateTask(entries);

return deDupTaskID;

},

type: 'createDuplicateCITask'
});

ChittiS
Tera Expert

Hi @Vishnu-K ,
Other than writing code, do we have any other alternative in CMDB Side?
Thanks

Hi @ChittiS ,

 

There is no other way to do it cause ServiceNow it self mentioned to use the "CMDBDuplicateTaskUtils " in their docs.

VishnuK_0-1770287881600.png

 

Hope this helps you, Please do mark it as helpful . And accept the solution.

Thanks,

Vishnu.

 

Hi @ChittiS ,


If the information provided was helpful, kindly mark it as helpful and accept the solution to close the thread for better community visibility.

 

Thanks,

Vishnu