Find the insights and best practices about our product.
🤖 Trackline – Proactive automation
🔎 SmartCheck – Digital evidence
🚀 Use cases by sector
Food sector
Construction sector
Industrial sector
Logistics sector
👤 Role based use cases
📊 Use cases by functionality
🤝🏻 Partners
Trackline Integration with NetSuite

Trackline Integration with NetSuite

Export documents and additional data from Trackline to NetSuite via API queries.

Trackline is a functionality of the Code Contract platform that allows you to automate data collection without changing workflows or requiring manual records.

Step 1: Get the authentication token

NetSuite must authenticate with the Trackline API using a POST request to obtain a JWT token. This token will be used in subsequent requests.

Request from NetSuite (HTTP Request)

POST /login HTTP/1.1
Host: api.codecontractplattform.com
Content-Type: application/json

{
"email": "netsuite_integration_user",
"password": "netsuite_secure_password"
}

Expected response

HTTP/1.1 200 OK
Content-Type: application/json

{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmV..."
}

Store this token in NetSuite and send it as a Bearer Token in the authorization header of each request.

Step 2: Query additional data and files in Trackline from NetSuite

Query process metadata
NetSuite can retrieve information about a specific process using process_id or process_name.

GET /track-line/ext/track-path/metadata?process_id=12345 HTTP/1.1
Host: api.codecontractplattform.com
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmV...

Expected response (JSON)

{
"process_id": "12345",
"name": "NetSuite Billing Process",
"status": "In Progress",
"created_at": "2024-02-09T10:30:00Z",
"documents": [
{
"doc_id": "98765",
"doc_name": "Invoice_001.pdf",
"doc_type": "Invoice"
}
]
}

Download an attachment

GET /track-line/ext/attachment/file?attachment_id=98765 HTTP/1.1
Host: api.codecontractplattform.com
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmV...

The server responds with a file (PDF, XML, etc.) that NetSuite can store or process.

NetSuite Integration (SuiteScript 2.0 Example)

/**
* @NApiVersion 2.x
* @NModuleScope Public
*/
define(['N/https', 'N/log', 'N/file'], function(https, log, file) {
function getToken() {
var url = "https://api.codecontractplattform.com/api/login";
var headers = { 'Content-Type': 'application/json' };
var body = JSON.stringify({
email: "netsuite_integration_user",
password: "netsuite_secure_password"
});
var response = https.post({ url: url, headers: headers, body: body });
return JSON.parse(response.body).token;
}

function getProcessMetadata(processId) {
var token = getToken();
var url = "https://api.codecontractplattform.com/api/track-line/ext/track-path/metadata?process_id=" + processId;
var response = https.get({ url: url, headers: { 'Authorization': 'Bearer ' + token } });
return JSON.parse(response.body);
}

function downloadAttachment(attachmentId) {
var token = getToken();
var url = "https://api.codecontractplattform.com/api/track-line/ext/attachment/file?attachment_id=" + attachmentId;
var response = https.get({ url: url, headers: { 'Authorization': 'Bearer ' + token } });
var fileObj = file.create({
name: "Invoice_001.pdf",
fileType: file.Type.PDF,
contents: response.body,
folder: -15
});
return fileObj.save();
}

return { getProcessMetadata: getProcessMetadata, downloadAttachment: downloadAttachment };
});

✅ Summary

  • Step 1: NetSuite retrieves JWT Token.
  • Step 2: Query process metadata via process_id.
  • Step 3: Download attachments via attachment_id.
  • Step 4: Automate processes using SuiteScript 2.0 or an API connector.