Transform maps

Ram012
Tera Contributor

Create Transform map and load the data like in the excel sheet there are 10 rows data 1 to 5 Mandatory & 6 to 10 Non - mandatory.

 

Any idea how to build the sample transform map script , exact code ?

3 REPLIES 3

Robert H
Mega Sage

Hello @Ram012 ,

 

Create a Transform Script, set "When" to "onBefore" and use the following script, but put in your own Excel sheet column names of course.

 

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

    var mandatoryColumns = [
        'u_column1',
        'u_column2',
        'u_column3',
        'u_column4',
        'u_column5'
    ];

    if (mandatoryColumns.some(col => !source[col])) {
        ignore = true;
        log.error('Mandatory data is missing in row ' + source.sys_import_row);
    };

})(source, map, log, target);

 

Regards,

Robert

swapnali ombale
Kilo Sage

Hi @Ram012 

 

The steps are:

  1. Navigate to system import sets -- > load data
  2. Load the excel sheet
  3. Once the data is loaded, you would get the Create transform map option (this would come up if there is no existing transform map present in the instance)
  4. Here you can select the target table, and then map the columns in the excel sheet to the fields on the target table.
  5. Once the mapping done, you need to click on transform now.

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

Ankur Bawiskar
Tera Patron
Tera Patron

@Ram012 

Sorry but you didn't share what you have configured and what's not working, so can't help much.

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