top of page
  • Writer's pictureTejkaran Singh

No Code Salesforce and NetSuite Integration

The first cloud computing software provider is recognized to be NetSuite. You can manage your sales process more effectively with real-time access to your back office thanks to the automatic, real-time connection between Salesforce and NetSuite, which also eliminates data entry tasks, cost overhead, and data duplication.

In this blog, we will go over the features, benefits, prerequisites, and No Code Salesforce and NetSuite integration process;

Features of Salesforce and NetSuite

360-Degree Visibility

Track the processing of sales orders or keep track of consumer financial activities like credits and refunds in real-time.

Numerous Customizations

By including the capabilities that are most beneficial for your organization, you can make your integration work for you.

Extra Features

Enhance efficiency by synchronizing order cancellations, removing items from the store, etc.

Unified Product Information

Real-time product export from NetSuite to Salesforce will provide your sales team access to the most recent product information.

Standardized product pricing levels

Easily synchronize product price, numerous pricing tiers, and support for multiple currencies between NetSuite and Salesforce

Real-time Sales Order Synchronization

Create quotes and sales orders in NetSuite in real-time from won or closed Salesforce opportunities while automatically syncing the relevant data.

Easy to deploy

Immediately deploy to get you moving with the least amount of fuss


  • One's Salesforce profile.

  • A NetSuite profile.

  • Working knowledge of NetSuite and Salesforce

Benefits of Salesforce and Netsuite Integartion

  • An improvement in productivity and cash flow efficiency

  • Improve Processes

  • Get Vital Customer Data

  • Accuracy of Data

  • Dashboards & Reports for 360° Financial Visibility

Integration Process

Make Restlet scripts and add them to the NetSuite platform.

A JS script for adding new fields is added to NetSuite as the first step in the NetSuite Salesforce Integration. The following code is necessary to create a new contact (as you must add a new script file for each object you want to synchronize between NetSuite and Salesforce).

// Create a standard NetSuite record

function createRecord(datain)


var err = new Object();

// Validate if mandatory record type is set in the request

if (!datain.recordtype)


err.status = “failed”;

err.message= “missing recordtype”;

return err;


var record = nlapiCreateRecord(datain.recordtype);

for (var fieldname in datain)


if (datain.hasOwnProperty(fieldname))


if (fieldname != ‘recordtype’ && fieldname != ‘id’)


var value = datain[fieldname];

if (value && typeof value != ‘object’) // ignore other type of parameters


record.setFieldValue(fieldname, value);









record.setCurrentLineItemValue(‘addressbook’, ‘country’, ‘US’);

record.setCurrentLineItemValue(‘addressbook’,’label’,’billing address’);




record.setCurrentLineItemValue(‘contact’, ‘firstname’, datain.firstname);


var recordId = nlapiSubmitRecord(record);


var nlobj = nlapiLoadRecord(datain.recordtype,recordId);

return nlobj;


Salesforce Account Authentication for NetSuite

Authentication is necessary for all data transfers. To authenticate the NetSuite account for Salesforce, see the sample script in the code below. The majority of times when NetSuite and Salesforce are integrated, it is advisable to carry out the authentication calls using NetSuite credentials and utilize Salesforce to access or transfer data to NetSuite.

public static void createNSCustomerRecord(account acc){

HttpRequest req = new HttpRequest();

HttpResponse res = new HttpResponse();

String endpoint = currNetSuiteSettings.NSEndpointCreateCustomer__c;


string custId;

//Set Method and Endpoint and Body



Http http = new Http();

String responseBody;


string NetSuiteProductionAccount = currNetSuiteSettings.NetSuiteProductionAccount__c;

string NetSuiteProductionUserName = currNetSuiteSettings.NetSuiteProductionUserName__c;

string NetSuiteProductionPassword = currNetSuiteSettings.NetSuiteProductionPassword__c;

String authorizationheader = ‘NLAuth nlauth_account=’+NetSuiteProductionAccount+’,


nlauth_email= nlauth_email+NetSuiteProductionPassword;

//Construct Authorization and Content header

req.setHeader(‘Authorization’, authorizationHeader);

string recordType = ‘customer’;

string accountId = ”;

accountId = acc.Id;


//you need the minimum field pattern for whatever entity you are posting, refer to their API guide




try {

res = http.send(req);

responseBody = res.getBody();


JSONParser parser = JSON.createParser(responseBody );

while (parser.nextToken() != null) {

System.debug(‘Current token: ‘ + parser.getCurrentToken());

// Advance to the next value.


// Get the field name for the current value.

String fieldName = parser.getCurrentName();

if(fieldName == ‘id’)


// Get the textual representation of the value.

System.debug(‘fieldName ==id’);

custId = parser.getText();





try {

List <account> acc1 = [select NetSuiteCustomerId__c from account where id=];

if(acc1.isEmpty() == false) {

acc1[0].NetSuiteCustomerId__c = custId;

update acc1;


} catch(System.CalloutException e) {

System.debug(‘Callout error: ‘+ e);


} catch(System.CalloutException e) {System.debug(res.toString());}


Execute Classes Between Salesforce and NetSuite in Batches

Although the entire sync procedure can be carried out in real-time, running it in batches is the ideal choice. To make and execute these batches, use the following code.

global class NetSuiteBatchApexWebCalloutClass Implements Database.Batchable<account>, Database.AllowsCallouts{global List<account> accountsToTarget;

private NetSuiteBatchApexWebCalloutClass(){}

Global NetSuiteBatchApexWebCalloutClass(Set<String> accRecIds)


accountsToTarget = [SELECT Id, Name,owner.Name,NetSuiteCustomerId__c FROM Account where Id IN : accRecIds];

}global Iterable<account> start(database.batchablecontext BC){

return (accountsToTarget);


global void execute(Database.BatchableContext BC, List<account> scope){

for(Account a : scope){




global void finish(Database.BatchableContext info){ }//global void finish loop


Voila! Salesforce and NetSuite and integrated seamlessly. If you are looking to integrate Salesforce with third-party apps, look no further and get in touch with our seasoned experts at Apphienz. We are rated amongst the top Salesforce partners providing personalized and customized Salesforce services like Managed services and support, Salesforce integrations, Salesforce app development, etc.

Visit our website to know more about us and get in touch with us in case of any further queries. We will get back to you at the earliest.


bottom of page