Asset to CI Update - Custom Synced Fields?

adam_seeber
Kilo Explorer

Hi folks - I know there are some specific synchronisations set up for fields when an Asset record is updated, that will push these through to the related Config Item. I'd like to add a field to that sync (both from Asset > CI, and CI > Asset.

On both tables/forms I have a field called u_device_type with the same list of choices. What can I do to make sure that when someone updates the Asset or CI, the change is reflected in the related CI or Asset record?

Thanks,

-Adam

1 ACCEPTED SOLUTION

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Hi Adam,



What about a business rule per table that would run after an update?



Regards,


Sergiu


View solution in original post

4 REPLIES 4

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Hi Adam,



What about a business rule per table that would run after an update?



Regards,


Sergiu


Thanks Sergiu,



What's the easiest way to get my newly created rules to apply to the items I already have in the system? Do I need a script that will go through and perform the action? I'd rather not have to go through and update every record - I'm sure there's an easier way, I'm just a bit simple



Essentially, I have a few thousand records that need to be updated, that already exist. The business rule will address any new items, any thoughts on the existing?



Cheers,


-Adam


Hi Adam,



Essentially, if you want to apply the content of your new business rule to the existing records, why then not run the script via background scripts to update all existing records? This should be done before deploying the new business rule, otherwise you might get duplicate updates and you don't want that.



Something like for example:



var gr = new GlideRecord('incident');


gr.query();



while (gr.next()){


    // here comes the content of your business rule


    ......    


    //don't forget to finally update the record


    gr.update();


}


You will need to test this on a subproduction instance and verify that results are the ones you expect.



Regards,


Sergiu


epam
Kilo Guru

Hi Adam,



There are two OOTB Business Rules : "Update Asset fields on change" and "Update CI fields on change" which use   "AssetAndCISynchronizer" class to synchronize Assets and CIs.


You can modify this script include (not recommended) or create your own business rules.