VaranAwesomenow
Mega Sage

Export sets and export definition are a great way to export data from ServiceNow.

But you need a big list of columns to be added to an export definition it can get very tedious sometimes.

In this blog I share a script that will make this process easier.

Step 1 would be to create export definition and have the sysId handy.

Step 2 In below script update export def sysid with export definition sysid

field_list contains list of comma separated column names that need to be added to export definition.

If you need any dotwalked fields then those can be added too.

Once below script is run it updates the field list on the export definition.

var field_list = 'correlation_id,sys_id,name,install_status,operational_status,manufacturer.name,vendor.name';
var grDef = new GlideRecord('sys_export_definition');
grDef.get(<export def sysid>);
grDef.field_list = field_list ;
grDef.update();