Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Robust transform map target List field

newservicenowus
Tera Guru

Hi All

 

Just wondering whether anyone has any example scripts of importing into a Glide list through Robust transform ETL. I currently have a table lookup which updates fine if 1 sys id. However I require sysid's to append to the field.

 

Thanks

 

3 REPLIES 3

VivekSattanatha
Mega Sage

Hi,

 

Below is the sample where I populate the company sys_ids in an array from array of company name. As long as you are keeping the sys_ids in an array, the transform would take care of it.

 

(function(batch, output) {
   for (var i = 0; i < batch.length; i++) {
      var input = batch[i].input; // Value of the input column.
      var inputArray = input.split(',');
      var outputArray = [];
      for(var j=0; j<inputArray.length;j++)
      {
         var companyResult = new sn_cmdb_int_util.CmdbIntegrationHardwareModelUtil().cleanseCompany(inputArray[j]);
         outputArray.push(companyResult.companySysId);
      }
      if(global.JSUtil.nil(outputArray) == false)
         output[i] = outputArray.toString();
      else
         output[i] = ''; 
   }
})(batch, output);

 Regards,

Vivek

Thanks @VivekSattanatha 

 

This is an example of data load.

 

{"entity_id":"1","mss_entity_id":"12345","domain_entity_id":"5","created_date":"2024-10-07T12:24:16.670777Z","updated_date":"2024-10-07T12:24:16.670777Z"},

 

{"entity_id":"2","mss_entity_id":"12345","domain_entity_id":"6","created_date":"2024-10-07T12:24:48.921126Z","updated_date":"2024-10-07T12:24:48.921126Z"},

 

mss_entity_id could be the same number but we want to grab domain_entity_id to update the glide list

Ankur Bawiskar
Tera Patron
Tera Patron

@newservicenowus 

check the approach shared by @VivekSattanatha and it should help you

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader