how to utilize Skip_sync attribute in custom BR

arey yaar
Giga Guru

For the fields which im updating those are not present in cmdb_ci table , so i wont be able to utilize the Asset CI Mapping table, Instead i m planning to write a Br to Update the Values from CI to Asset and from Asset to CI.

I Tried with the below script but the update is happening twice. 

 am i missing anything

if (current.skip_sync != true) {
    var ci=new GlideRecord(current.ci.sys_class_name);
    ci.get(current.ci);
    ci.test=current.u_test;
    ci.u_test1=current.u_test1;
    ci.skip_sync=false;
    ci.update();
}

2 REPLIES 2

Community Alums
Not applicable

Hi,

The skip_sync field not only exists on assets but also on the cmdb table. It is the flag indicating whether synchronization between Asset and CMDB can be skipped (see the documentation: CMDB table attributes description).

There are OOB script includes and business rules that may invoke according functions and change the value of skip_sync:

  • AssetAndCISynchronizer: /nav_to.do?uri=sys_script_include.do?sys_id=9ec37b411b012000e49bfbcd2c071380
  • Update Asset fields on change: /nav_to.do?uri=sys_script.do?sys_id=31e93aaf1b3210002502fbcd2c0713d8
  • Update CI fields on change /nav_to.do?uri=sys_script.do?sys_id=4d15855c1b0310002502fbcd2c071399

The skip_sync flag is used to prevent recursion within the same cycle of business rules and will be reset in the next cycle during Asset-CI synchronization. The skip_sync flag is set to false by default.

As the two business rules above would be triggered twice during an Asset-CI synchronization. The skip_sync flag would be set to false again after the synchronization. In case the skip_sync flag was set to true for some reason, an update on the Asset/CI should help set the flag back to false.

Refer to the above mentioned BRs to get an idea how are they being used.

Mark my answer correct & Helpful, if Applicable.

Thanks,
Sandeep

I have already gone through the content which you refered from "https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0743665" the support .

 

But if i want to write a custom script to map the values how do i do it.

 

What am i missing in the above script