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.

Integration hub import data from excel and transform target fields before inserting

Naveen Sai Teja
Tera Contributor

I am trying to load data from excel to servicenow table using integration hub imports. Before inserting the data to target table , I have to set few extra fields for which mappings were not there. I am using beforeRun script to set the values before inserting but they are failing to do. below is the code used in beforeRun script

 

(function onBefore(source, target, importLog) {
   
    var id=source["u_id"];
    var glideRecord=new GlideRecord("csm_consumer");
    glideRecord.addQuery("number",id);
    glideRecord.query();
    if(glideRecord.next()){
        ignore=true;
        ignore_reason='consumer already exist with this id';
        importLog.warn("consumer already exist with this id-"+id);
    }
target['active']=source['u_firstname']&&source['u_email']; // need to set active to true if firstname and email are there
// this active field will not be sent in the data source(excel) 
})(source, target, importLog);
1 REPLY 1

pjftenorio
Tera Guru

I have the same issue, did you find a solution on this?