Function to create contacts in Netsuite using Suitelets

function createContact(firstname,lastname,email,phone,mrms,company,Newsletter){
    
    var obj = nlapiCreateRecord('contact',{recordmode: 'dynamic'});
    obj.setFieldValue('firstname', firstname +' '+ lastname);
    obj.setFieldValue('phone', phone);
    obj.setFieldValue('company', company);
    obj.setFieldValue('subsidiary', 1);
    obj.setFieldValue('salutation',mrms);   
    obj.setFieldValue('email', email);
    
    if(Newsletter =='on'){
        obj.setFieldValue('globalsubscriptionstatus', 1);
    }else{
        obj.setFieldValue('globalsubscriptionstatus', 2);
    }
    
    var id= nlapiSubmitRecord(obj);
    return id;
    
}

Popular posts from this blog

What are sales territory in Netsuite?

How to get and set a sublist in netsuite suitlet suitescript 2.0