- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2020 02:05 AM
Hi All,
I have some series of question required for a Document requested from our client on SCCm integration.
But i don't want to put them all in one current question so i will be creating multiple question on them, i would like you to answer my question and help me in creating this document .
Let me start with this Question:
Question:
I would like to understand a code written in SCCM integration transform map.
This code is written in onAfter transform map and I would like to know what that code is doing or any reference to document where the detail of that code is available.
// Build up the sys_object_source entry...
buildSource();
function buildSource() {
var sourceObj = new ObjectSource("SCCM", target.sys_class_name, target.sys_id, source.u_resourceid + '');
sourceObj.setValue("last_scan", source.u_lasthwscan + '');
sourceObj.process();
}
buildSerialNumbers();
function buildSerialNumbers() {
var snm = new SerialNumberManager();
if (JSUtil.notNil(source.u_systemserialnumber))
snm.add('system', source.u_systemserialnumber);
if (JSUtil.notNil(source.u_uuidserialnumber))
snm.add('uuid', source.u_uuidserialnumber);
if (JSUtil.notNil(source.u_chassisserialnumber))
snm.add('chassis', source.u_chassisserialnumber);
if (JSUtil.notNil(source.u_biosserialnumber))
snm.add('bios', source.u_biosserialnumber);
if (JSUtil.notNil(source.u_baseboardserialnumber))
snm.add('baseboard', source.u_baseboardserialnumber);
var srlArr = snm.getSerialsForCIData();
var gr = new GlideRecord(target.sys_class_name);
gr.get(target.sys_id);
//below mention code of line is something where I am stuck and need your help
var tr = new SncDiscoveryReconciler("cmdb_serial_number", "cmdb_ci", gr);
tr.reconcile(srlArr, 'serial_number,serial_number_type');
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2020 02:40 AM
Hi, IT
This Code is part of Service now SCCM integration and is used in onAfter Script to make sure no duplicate Serial number or records are created in Service now.
// Build up the sys_object_source entry... buildSource(); function buildSource() { var sourceObj = new ObjectSource("SCCM", target.sys_class_name, target.sys_id, source.u_resourceid + ''); sourceObj.setValue("last_scan", source.u_lasthwscan + ''); sourceObj.process(); }
//This line of code check whether the record is we are going to process is already in the system or not.
//If the record is in object source table then updating is performed else Insertion is performed.
buildSerialNumbers(); function buildSerialNumbers() { var snm = new SerialNumberManager(); if (JSUtil.notNil(source.u_systemserialnumber)) snm.add('system', source.u_systemserialnumber); if (JSUtil.notNil(source.u_uuidserialnumber)) snm.add('uuid', source.u_uuidserialnumber); if (JSUtil.notNil(source.u_chassisserialnumber)) snm.add('chassis', source.u_chassisserialnumber); if (JSUtil.notNil(source.u_biosserialnumber)) snm.add('bios', source.u_biosserialnumber); if (JSUtil.notNil(source.u_baseboardserialnumber)) snm.add('baseboard', source.u_baseboardserialnumber);
//This method is just used to get all serial numbers from the staging table and create a JSON object of all Serial numbers to pass to the reconciler code.
//below mention code of line is something where I am stuck and need your help var tr = new SncDiscoveryReconciler("cmdb_serial_number", "cmdb_ci", gr); tr.reconcile(srlArr, 'serial_number,serial_number_type');
//This is Service now Code which can not be found out in Service now, this code make sure no duplicate serial number are there in service now
Mark Correct/Helpful if I answer your question
Rajat Singh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2020 02:40 AM
Hi, IT
This Code is part of Service now SCCM integration and is used in onAfter Script to make sure no duplicate Serial number or records are created in Service now.
// Build up the sys_object_source entry... buildSource(); function buildSource() { var sourceObj = new ObjectSource("SCCM", target.sys_class_name, target.sys_id, source.u_resourceid + ''); sourceObj.setValue("last_scan", source.u_lasthwscan + ''); sourceObj.process(); }
//This line of code check whether the record is we are going to process is already in the system or not.
//If the record is in object source table then updating is performed else Insertion is performed.
buildSerialNumbers(); function buildSerialNumbers() { var snm = new SerialNumberManager(); if (JSUtil.notNil(source.u_systemserialnumber)) snm.add('system', source.u_systemserialnumber); if (JSUtil.notNil(source.u_uuidserialnumber)) snm.add('uuid', source.u_uuidserialnumber); if (JSUtil.notNil(source.u_chassisserialnumber)) snm.add('chassis', source.u_chassisserialnumber); if (JSUtil.notNil(source.u_biosserialnumber)) snm.add('bios', source.u_biosserialnumber); if (JSUtil.notNil(source.u_baseboardserialnumber)) snm.add('baseboard', source.u_baseboardserialnumber);
//This method is just used to get all serial numbers from the staging table and create a JSON object of all Serial numbers to pass to the reconciler code.
//below mention code of line is something where I am stuck and need your help var tr = new SncDiscoveryReconciler("cmdb_serial_number", "cmdb_ci", gr); tr.reconcile(srlArr, 'serial_number,serial_number_type');
//This is Service now Code which can not be found out in Service now, this code make sure no duplicate serial number are there in service now
Mark Correct/Helpful if I answer your question
Rajat Singh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2020 03:03 AM
Hi Rajat,
Thanks for your Quick Response , if possible can you provide more detail on SncDiscoveryReconciler method.
Regards,
IT

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2020 03:25 AM
Hi,
You can refer to below mentioned Docs.
https://community.servicenow.com/community?id=community_blog&sys_id=c33e22addbd0dbc01dcaf3231f96191a
https://old.wiki/index.php/Packages_Call_Replacement_Script_Objects
https://docs.servicenow.com/bundle/orlando-application-development/page/script/general-scripting/concept/c_PackagesCallRemovalTool.html
https://hi.service-now.com/kb_view.do?sysparm_article=KB0750386
Mark Correct/Helpful it answers your question
Regards,
Rajat Singh