PROPOSAL FOR CLIENT AND CONTACT CREATION VIA RESTLET

PROPOSAL SUMMARY 

This proposal covers the scope of the integration to create client and contact records in NetSuite via REST API 

REQUIREMENT 

Integration between the NetSuite & external website to create client and contact records in NetSuite when a new customer signs up on the website. Both should be two separate standalone integration. 

OUR SOLUTION 

Two RESTlet scripts will be implemented in the NetSuite for creating APIs for NetSuite to accept the POST request sent to NetSuite to create customer and contact records on a real-time basis. After creating the Customer or Contact records we will trigger the Map Reduce script(Customer Transmission Map Reduce). 

CUSTOMER CREATION 

The following table data will describe the request parameters accepted by NetSuite API. 

JSON Request Field NetSuite Field Internal ID Description/Default Values 
companyName Company name  companyname Mandatory field 
customerType Customer Type custentity_customertype Business, unless user confirms charity details then = Charity 
email Email email Mandatory field 
primarySubsidiary Primary Subsidiary subsidiary Blueleaf Limited 
location Location custentity_custlocation Mandatory field 
addressee Addressee addressee Same as company name 
address1 Address 1 addr1  
city City city  
country Country country  
postCode Zip zip  
defaultShippingAddress Default Shipping Address defaultshipping True 
defaultBillingaddress Default Billing address defaultbilling True 
shippingMethod Shipping Method shippingitem Nextday (Standard) 
tier Tier territory Mandatory field 
accountType Account Type custentity_region Sales 
visitFrequencyPerYear Visit Frequency Per Year custentity_supportlevel 
groupAccountManager Group Account manager custentity_groupaccountmanager E368 Service & Support Team 
internalAccountmanager Internal Account manager custentity_internalaccountmanager E368 Service & Support Team 
regionalAccountMaager Regional Account Manager custentity_internalaccountmanagerstatus E368 Service & Support Team 
crmAccount CRM Account custentity_client_crm_account Yes 
leadSource Lead Source leadsource Ecommerce 
terms Terms terms Due on receipt/Card 
creditLimit Credit Limit creditlimit 
primaryCurrency Primary Currency currency GBP 
invoiceFrequency Invoice Frequency custentity_invoicefrequency Daily 
statementRequirement Statement Requirement custentity_statement_not_required Individual Statement required 
invoiceFormat Invoice Format custentity_invoiceformat GCL Invoice 
cashSaleFormat Cash Sale Format custentity_cashsaleformat GCL Cash Sale 
salesOrderFormat Sales Order Format custentity_salesorderformat GCL Sales Order 
statementTemplate Statement Template custentity_statementtemplate GCL Statement 

SAMPLE REQUEST FORMAT 

{ 
    “companyName”: “TEST Customer”, 
    “customerType”: “Business”, 
    “email”: “test@abc.com”, 
    “location”: “Chatham Depot” 
    “address”: 
            { 
                “address1”: “test address”, 
                “city”: “test city”, 
                “country”: “GB”, 
                “postCode”: “456789”, 
            }, 
        “tier”: “Tier 1” 
} 

RESPONSE AND ERROR MESSAGE 
 

Response for Customer creation in NetSuite will contain following fields: 

JSON Response Field Description 
statusCode Response status as Success or Failure  
Response message If statusCode is success entityid of created customer  
Error message NetSuite error or standard message if the statusCode is failure 

SAMPLE RESPONSE FORMAT 

{ 
    “statusCode”: “SUCCESS”, 
    “customerId”: C116841 Test Customer , 
} 

{ 
    “statusCode”: “FAILURE”, 
    “error”: companyName is mandatory”, 
} 

Response Status Codes: 

SUCCESS 

FAILURE 

Response Messages: 

  1. CompanyName is mandatory 
  1. CustomerType is mandatory 
  1. Email is mandatory 
  1. Tier is mandatory 
  1. Invalid Location 

CONTACT CREATION 

The following table data will describe the request parameters accepted by NetSuite API 

JSON Request Field NetSuite Field Internal ID Description/Default values 
companyName Company company entityid of customer 
contactName Contact entityid  Mandatory field 
contactEmail Email email Mandatory field 
contactSubsidiary Subsidiary subsidiary Blueleaf Limited 
contactPhoneNumber Main Phone phone Mandatory field 
jobTitle Job Title custentity3 Mandatory field 

SAMPLE REQUEST FORMAT 

{ 
    “companyName”: “TEST Customer”, 
    “contactName “: “TEST TEST”, 
    “role”: ” Primary Contact “, 
    “contactEmail”: “test@abc.com” 
    “jobTitle”: “Other” 
    “contactPhoneNumber”: “789456455” 
} 

RESPONSE AND ERROR MESSAGE 
 

Response for Customer creation in NetSuite will contain following fields: 

JSON Response Field Description 
statusCode Response status as Success or Failure  
Response message If statusCode is success entityid of created contact  
Error message NetSuite error or standard message if the statusCode is failure 

SAMPLE RESPONSE FORMAT 

{ 
    “statusCode”: “SUCCESS”, 
    “customerId”: 104, 
} 

{ 
    “statusCode”: “FAILURE”, 
    “error”: companyName is mandatory”, 
} 

Response Status Codes: 

SUCCESS 

FAILURE 

Response Messages: 

  1. companyName is mandatory 
  1. role is mandatory 
  1. contactEmail is mandatory 
  1. jobTitle is mandatory 
  1. contactPhoneNumber is mandatory 
  1. contactPhoneNumber is invalid 

ERROR HANDLING AND EMAIL NOTIFICATION 

 We will be creating a custom record for tracking errors that happen during API requests. It will be used for both APIs customers and contact. And also, we will be notifying the administrator using email notification with the custom record link.  

API SETUP 

 API credentials will be shared to the Application user to send request to NetSuite. The Integration record will be created in the NetSuite with Auth 1.0 credentials. The token will be generated for the customized role.  

Steps in customized role setup:  

  • “External API User” role will be created in the account for the user to Use the API with limited permissions  
  •  Employee records will be created for the external API user.  
  •  Role will be added to the new user  
  •  Token will be generated for the new customised role 

TRIGGER MAP-REDUCE 

We will be triggering the existing Customer Transmission Map Reduce script to send customer or contact information from NetSuite to the website after successful completion of creation of a customer or contact record in NetSuite.  

ASSUMPTIONS 

  • We will only be creating POST request APIs for the creation of Customer and Contact records in NetSuite and we are not updating the already created records. 
  • We will be validating all the mandatory fields for the creation of customer and contact record. 
  • Deletion of the record are out of scope. 
  • We will be creating a custom record for only error handling in NetSuite if the request is failed. If the request is success, we will not be creating any custom record entry. 
  • We are creating record with active state and inactive records will be out of scope. 
  • Inactivating fields and changing field type is out of scope. 
  • We will be considering only Blueleaf Limited subsidiary for creating customer and records. 
  • Location should provide from the subsidiary Blueleaf Limited. 
  • Phone Number digits should be greater than 7 digits. 
  • Email should be valid and we are not validating the format. 
  • Request data should be in JSON format. 
  • Only one record will be created for a single request. Blue leaf can initiate separate request per record. 
  • Duplication detection of records out of scope. 
  • We assume the integration to send customer information from NetSuite to the website exist already in website. We just only need to trigger existing map reduce script. 

RISKS 

Restlet script characteristics 

  • 5,000 usage units per script 
  • Maximum 10MB per string used as RESTlet input or output 

Leave a comment

Your email address will not be published. Required fields are marked *