Define a JSON Object to Represent a NetSuite Record

Documentation article about Define a JSON Object to Represent a NetSuite Record To use the data in a NetSuite record, you must determine how to represent the

·1 min read·View Oracle Docs

To use the data in a NetSuite record, you must determine how to represent the record as a JSON object. For example, a custom record containing a set of questions and answers may have the following structure:

  • record name - customrecord_q_and_a

  • custom field - custrecord_q_and_a_queston

  • custom field - custrecord_q_and_a_answer

A JSON object representing this custom record would look like the following:

javascript
{
"question": "A String with the question"
, "answer": "A String with the answer"
, "createdAt": "2016-03-31"
}

This example only requires name/value pairs representing each custom field and its value. However, depending on the complexity of the record you need to represent, a JSON object can be more complex. For example, a JSON object can contain arrays or nested objects.

After defining the formal structure of a JSON object, you can define the backend model that accesses the NetSuite record. See Create a Backend Model for more information.

Related Topics

  • Services and Backend Models in Custom Modules
  • Create a Backend Model
  • Create a Service to Handle HTTP Requests

General Notices

Frequently Asked Questions (4)

Does the JSON object structure for representing a NetSuite record support nested objects?
Yes, a JSON object can support nested objects and arrays, adding complexity to the representation of a NetSuite record if needed.
Do I need to define a backend model after creating a JSON object for a NetSuite record?
Yes, after defining the JSON object structure, you should define a backend model that interacts with the NetSuite record.
What is required to search and filter records in a backend model using SuiteScript?
You need to define filters and columns to search and filter records, using functions like nlobjSearchFilter and nlobjSearchColumn, as shown in the search method of the backend model.
How can validation be implemented in a backend model for a NetSuite record?
Validation can be implemented by defining a validation object that specifies required fields and associated messages, as shown with the 'question' field being required in the backend model example.
Source: Define a JSON Object to Represent a NetSuite Record Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Platform

View all Platform articles →