Capture Data into Update Set

Capture Data into Update Set

DataCapture

 Capture Data into Update Set

For moving application to one instance to another, we must move its group, users, roles along with update set. Usually we capture those in different xml file, and while deploying need to deploy those files separately.

If you don’t want to send those users and roles files separately, then you can also send those with in update set. So single update set can capture everything (roles, user, updates).

For that we just need to create one UI action, and it’s very simple, that UI action allow us to transfer data from instance via update set. So let’s start to create.

Step 1: Create UI action

  • Make one UI action on global table.
  • With underwritten script code.
var table = current.getTableName();  
var sysID = current.sys_id + '';  
  
addToUpdateSet(table, sysID);  
  
function addToUpdateSet(table, recordId)  
{  
  var um;  
  if (typeof GlideUpdateManager2 != 'undefined'){  
  um = new GlideUpdateManager2();  
  }  
  else{  
  um = new Packages.com.glide.update.UpdateManager2();  
  }  
  var rec = new GlideRecord(table);  
  rec.get(recordId);  
  um.saveRecord(rec);  
}

Code For UI action

Step 2: Capture Data

After creating UI action, you can get link, like that I am getting here one form link on my page.

role_screenshot

Roles – Want To capture

 

Step 3: Check Update Set

I just click on Push to Update Set and those roles automatically capture on my current running update set as you can see here. I hope it will also help you guys.

role_screenshotrole_screenshot

Captured Data in Update Set (Role)

One Comment

  • prasanna says:

    October 20, 2017 at 5:34 pm

    or we may use this in the background script
    note: provided the update set we want to capture is the update set we are currently using.

    //Query for the record
    var rec = new GlideRecord('sys_number');
    rec.get('973c8e8a9d022000da615b13b3a22f32');
    //Push the record into the current update set   
    var um = new GlideUpdateManager2();
    um.saveRecord(rec);
    

Leave a reply

Your email is never published nor shared. Required fields are marked *

Are you Human? * Time limit is exhausted. Please reload CAPTCHA.

Pin It on Pinterest

Share This