Anurag Tripathi
Mega Patron
Mega Patron

I have often come across this question in various forms:

  • What gets captured in Update sets
  • How does platform decide what to capture
  • How can we capture data of a certain table as well

Ill try to answer all the above questions in this Blog.

 

In simple terms, ServiceNow OOTB is configured in a way to capture all customizations and configurations in update sets but not data, the next question arises that how does it differentiate between data and configurations?

ServiceNow uses an attribute called update_synch to identify this.

Each table has a collection field, in the attributes field of the collection type field on the table you can see this attribute, as shown in the image below

 

 find_real_file.png

Force to Update set

There are still situations were we occasionally need to capture few things in update set.

If you need to capture something in an update set, that doesn't get captured automatically, please don't add the attribute explained above , instead you can use the method below to do so.

  1. Create an update set (that you want to capture data) and make it your current update set
  2. Navigate to scripts - background
  3.  Loop through the records you want to capture in a glide record query and pass the glide record obect in teh function below
    var gum = new GlideUpdateManager2();
    gum.saveRecord(<glide record object to record>);
  4. Validate your update set

 

For EG, if I want to capture the incidents with number INC0000002, INC0000003 & INC0000004 in my current update set. I'll follow step 1 and 2 above and run the script below in background script

 

var gr = new GlideRecord('incident');
gr.addEncodedEquery('numberININC0000002,INC0000003,INC0000004');
gr.query()
while(gr.next())
{
var gum = new GlideUpdateManager2();
gum.saveRecord(gr);
}

 

 

 

 Related links to read more: Tracked Customizations

 

PS: Do not add the update_synch attribute to a dictionary record. When improperly used, this attribute can cause major performance issues or cause the instance to become unavailable. Adding this attribute is not supported. If in doubt consult with HI support before adding/removing this attribute form a table

 

 

4 Comments