In import log error message , is it possible to display the row number of the excel where value is invalid along with the error ?

Servicenow12
Tera Contributor

In import log error message , is it possible to display the row number  of the excel where value is invalid along with the error ?

I am using Use source script to throw an error if the value is invalid as below, Can we bring the row number also where the error is found ?

 

answer = (function transformEntry(source) {

 var user= source.u_assigned_to;

 var gr = new GlideRecord("sys_user");
 gr.addQuery("name", user);
gr.addQuery("active",true);
 gr.query();

 if (gr.next()) {
    return gr.name;
 } 
 else{
    log.error('There is no user available with name   ' + source.u_assigned_to);
 }

1 ACCEPTED SOLUTION

you can use source.sys_import_row to display the current row in error_message like this

if(source.name=="no_tranform"){
  error = true;
  error_message = "Source is not intended for transformation" + source.sys_import_row ;
}

View solution in original post

6 REPLIES 6

Thanks for this, exactly what I was looking for.  This worked:  

source.sys_import_row

Thanks for this, exactly what I was looking for.  This worked:  

source.sys_import_row ;