Token based authentication needs many input parameters such as WSLD URL, Consumer Key, Consumer Secret, Token, Token Secret and Account ID.
I had to spent bit of time to work-out how to get all above parameters values and in this blog I just want to share that learning.
There is already NetSuite Connector Documentation available which describe the instructions about Token Based Authentication. This blog is just expanding that document with some additional info and screenshots.
So, let’s get started-
Prerequisite
Before you establish connectivity from OIC to NetSuite using Token Based Policy there are certain prerequisite which you need to accomplish as listed below-
Enable Client/Server SuiteScript, REST/SOAP Suite Talk and Token based Authentication
To connect to Oracle NetSuite, you must have registered with Oracle NetSuite and enabled key features (such as SOAP and REST web services) on your Oracle NetSuite instance.
- Visit http://www.netsuite.com to register with Oracle NetSuite. Ensure that you obtain an account with administrator privileges.
- Enable connection-related features on your Oracle NetSuite instance.
Create an Integration Role with Token-Based Authentication (TBA) Permissions
Create a new role and assign TBA permissions along with other necessary permissions (specific to your integration) to it. You'll assign the Oracle Integration user account—which you'll subsequently create—to this role.
Note:
As a best practice, avoid using the Administrator and Full Access roles/users in Oracle NetSuite connections that use the TBA security policy.
To create a new role:
- On the NetSuite home page, select Setup, then User/Roles, then Manage Roles, and then New.
- On the Role page:
You can add other permissions to the role depending on the tasks you want to allow the users assigned this role to perform. For any custom role, you must specifically add the SOAP web services permission with the Full level. See Assigning the SOAP Web Services Permission to a Role.
Create a User Account for Oracle Integration
Create a user account for Oracle Integration and assign this account to the Token Base Authentication role “OracleIntegrationRole” you created previously. You'll use the credentials associated with this user account to connect to NetSuite from Oracle Integration.
follow the procedure provided here:
- On the NetSuite home page, select Lists, then Employees, then Employees, and then New.
- On the Employee page:
Create an Integration Record for Oracle Integration
Before you can create and assign API tokens (for TBA) to a user account, you must create an integration record for the application that will use this user account to access NetSuite.
Create an integration record for the Oracle Integration application.
- On the NetSuite home page, select Setup, then Integration, then Manage Integrations, and then New.
- On the Integration page:
Enter a name for the integration record, for example, “ExtIntegrationApp”
- Optionally, enter a description for the record.
- Leave the Enabled option selected in the STATE drop-down field.
- On the Authentication tab:
- Leave the TOKEN-BASED AUTHENTICATION check box selected.
- Deselect the TBA: AUTHORIZATION FLOW and AUTHORIZATION CODE GRANT check boxes.
- Click Save.
The confirmation page displays the client credentials for this integration record or application.
Create an Access Token for the User Account
Create and assign an access token to the Oracle Integration user account.
Note: “Access Tokens” page was not appearing before, only when I executed “Enable Client/Server SuiteScript, REST/SOAP Suite Talk and Token based Authentication” section as per this document then only “Access Token” page appears. The confirmation page displays the token values for the user account.
Make a Note of the NetSuite Account ID
Along with other credentials, you'll require the NetSuite Account ID to connect to NetSuite from Oracle Integration.
To view your account ID:
- On the NetSuite home page, select Setup, then Integration, and then SOAP Web Services Preferences.
- Note down the Account ID displayed at the top of the page.
- Click Cancel to exit the page.
Assemble the Oracle NetSuite WSDL URL
You need to draft the NetSuite WSLD using below technique -
Sample URL
https://<webservices.netsuite.com>/wsdl/<OracleNetSuite_application_version>/netsuite.wsdl.
So, In above URL you need to replace two things 1) Your NetSuite Instance URL and NetSuite Application Version.
To get those value follow the below steps.
NetSuite Instance URL –
Navigate to Setup >> Company >> Company Information >> Get Suite Talk URL
e.g. https://tstdrvxxxxxxx.suitetalk.api.netsuite.com
Get NetSuite Version –
Login to NetSuite Instance and bottom of home page you can see version –
e.g., 2021.2, now you need to convert this to this v2021_2_0
Final URL –
Now you just replace above two values in final URL –
https://<webservices.netsuite.com>/wsdl/<OracleNetSuite_application_version>/netsuite.wsdl.
https://tstdrvxxxxxx.suitetalk.api.netsuite.com/wsdl/v2021_2_0/netsuite.wsdl
Once you WSDL are ready, make sure you test in browser and it should open –
OIC Connection to NetSuite Using Token Based Authentication
Once all parameters values such as WSLD URL, Consumer Key, Consumer Secret, Token, Token Secret and Account ID are ready then make connection to NetSuite using NetSuite Adapter from OIC Home Page >> Integration >> Connection
Once connection is established, you can perform any CRUD operation for any business object as per your option available. In my case I did create Customer inside NetSuite by posting a JSON payload via REST Adapter to NetSuite Adapter.
Note: The role what you using to communicate to NetSuite e.g. in my case it was “OracleIntegrationRole” must have given permission to particular business object such as “Customers”, otherwise your integration will be keep failing and will give below error message –
{
"Status" : {
"IsSuccess" : "true",
"Type" : "ERROR",
"Code" : "INSUFFICIENT_PERMISSION",
"Message" : "Permission Violation: You need the 'Lists -> Customers' permission to access this page. Please contact your account administrator.",
"FaterSubmittedFailed" : ""
},
"ContactRef" : {
"InternalId" : "",
"ExternalId" : "",
"Name" : "",
"Status" : "false"
}
}
In order to fix above error. Make sure you give “Customer” and “Customer Profile” permission to “OracleIntegrationRole” role.
Here is my OIC Integration.
Here is my mapping.
Note:
There could be some mandatory field for the object what you trying to create inside NetSuite, so first try creating object directly using NetSuite frontend with minimal fields which will give you idea what are the mandatory fields needed for that object.
Happy blogging J