Discoverable Procedures
Discoverable procedures in the NetSuite (BDK) Book.
Ensure that you have connected the NetSuite book and then created a new playground before using these automation procedures.
Overview
In NetSuite, an entity is any object or record type that stores business data, such as a customer, employee, sales order, or custom record. Entities define how information is structured, including the fields, relationships, and operations available for that data.
Discovery scans your connected NetSuite account to identify these entities, their fields, and the actions they support. Each discovery generates these five automation procedures for a given entity:
Create: Add new records to NetSuite.
Retrieve: Fetch preview lists of records.
Retrieve Record Details: Get full record details including nested data.
Update Record: Modify existing records with new data.
Upload File Attachment: Upload files to NetSuite and link them to records.
Discovery
Use the following syntax to discover entities from your NetSuite instance and generate automation procedures. Replace ENTITY with the entity type to be discovered:
discover "ENTITY" from netsuite
NetSuite Entities
To view all discoverable entities, use:
retrieve discoverables from netsuite
Common NetSuite entities include:
People:
customer
,employee
,vendor
,partner
,contact
Items:
item
,inventoryItem
,serviceItem
,kitItem
Transactions:
salesOrder
,invoice
,purchaseOrder
Support:
supportCase
,task
,phoneCall
Custom Records: Your custom record types (e.g.,
customrecord_myrecord
)
Entity Names
NetSuite entity names use camelCase:
customer
(lowercase for simple entities)salesOrder
(camelCase for compound names)
Check out NetSuite's REST API documentation for additional details.
Examples
discover "customer" from netsuite
discover "item" from netsuite
discover "salesOrder" from netsuite
discover "employee" from netsuite
Procedures
After discovery, you can use the five generated procedures for that entity:
1. Create Record
Create a new record of the discovered entity type.
create a [ENTITY] record in netsuite
Parameters
the body is [DATA]
The data for the new record
Yes
Example
discover "customer" from netsuite
create a json
use the above as the body
set the body's "companyName" to "Acme Corporation"
set the body's "email" to "[email protected]"
set the body's "phone" to "555-1234"
create a customer record in netsuite
the body is the body
Returns: The newly created record with preview fields populated (includes ID and basic information).
Important Notes
Only required and create-able fields need to be provided
NetSuite will generate system fields like ID, creation date, etc.
The returned record is a "preview" version with essential fields
2. Retrieve Records
Get a list of records from the discovered entity type using SuiteQL queries.
retrieve some [ENTITY] records from netsuite
Parameters
the limit is [NUMBER]
Maximum number of records to retrieve (default: 10)
Optional
the offset is [NUMBER]
Number of records to skip for pagination (must be a multiple of the limit)
Optional
whose [FIELD] is [VALUE]
Filter records by specific criteria.
Note: Filter expressions are case-sensitive (e.g., "KOGNITOS" ≠ "Kognitos"). Use the "has" operator for partial matching, "is" for exact matching.
Optional
Examples
# Get records with default limit
retrieve some customer records from netsuite
# Get specific number of records
retrieve some customer records from netsuite
the limit is 20
# Get records with filtering
retrieve some customer records from netsuite whose companyName is "Acme Corporation"
# Get records with pagination
retrieve some salesOrder records from netsuite
the limit is 10
the offset is 20
Returns: A list of preview records matching the criteria.
Important Notes:
Uses SuiteQL for efficient querying
Returns "preview" records (lighter weight with essential fields)
Offset must be a multiple of the limit
For full record details, use the "retrieve details" procedure
3. Retrieve Record Details
Get the complete, detailed information for a specific record. Use this procedure when you need all the record information and not just the preview fields.
Command: retrieve a [ENTITY] record's detail from netsuite
Parameters
the record is [RECORD]
The preview record to get full details for
Yes
Example
# First, get a preview record
retrieve some customer records from netsuite
the limit is 1
use the first record as the customer
# Then get full details
retrieve a customer record's detail from netsuite
the record is the customer
Returns: The complete record with all fields and nested data.
4. Update Record
Update an existing record with new data.
update a [ENTITY] record in netsuite
Parameters
the record is [RECORD]
The record with updated data (must include ID)
Yes
Example
# Get a record
retrieve some customer records from netsuite whose companyName is "Acme Corporation"
use the first record as the customer
# Update the record
set the customer's "phone" to "555-9999"
set the customer's "email" to "[email protected]"
update a customer record in netsuite
the record is the customer
Returns: The updated record with current values.
Important Notes:
Only sends fields that have changed (differential update)
Automatically fetches remote record to compute differences
More efficient than sending entire record
5. Upload File Attachment
Upload a file to NetSuite's File Cabinet and attach it to a record. For this procedure, you need to select the folder in which the attachments will be saved.
upload a [ENTITY] record attachment in netsuite
Parameters
the record is [RECORD]
The record to attach the file to
Yes
the file is [FILE]
The file to upload
Yes
the file name is "[NAME]"
Name for the uploaded file
Yes
the folder id is "[FOLDER_ID]"
Specific File Cabinet folder to upload to
Optional
Examples
# Using default folder (configured in the department)
upload a customer record attachment in netsuite
the record is the customer
the file is the file
the file name is "contract.pdf"
# Specifying a specific folder
upload a customer record attachment in netsuite
the record is the customer
the file is the file
the file name is "contract.pdf"
the folder id is "12345"
Returns: The file ID of the uploaded attachment.
Important Notes:
Requires a File Cabinet folder ID (either in call or configured globally)
In order to configure a folder ID, you can do:
set the department's attachment folder id to "<the folder id>"
Uses SOAP API for file operations
If attachment fails, the uploaded file is automatically deleted (cleanup)
File is first uploaded to File Cabinet, then linked to the record
Complete Workflow Examples
1. Retrieving Message Attachments
This example shows how to retrieve messages and download their attachments:
# Discover the message entity
discover message from netsuite
# Find messages for a specific activity
retrieve some message records from netsuite whose activity is "1283324"
use the above as the messages
# Get the attachment ID from the message
the messages
the code is the message's "attachments"
# Download the attachment
retrieve an attachment from netsuite
the attachment id is the code
2. Comprehensive Record Management
This example demonstrates schema retrieval, filtering, creating, and updating records:
# 1. Retrieve schemas to understand object properties
retrieve a schema from netsuite
the entity is "employee"
retrieve a schema from netsuite
the entity is "supportCase"
# 2. Discover and retrieve employee records
discover employee from netsuite
retrieve some employee records from netsuite
retrieve some employee records from netsuite
the limit is 15
# 3. Filter employees by name
retrieve some employee records from netsuite whose firstname has "Paul"
retrieve some employee records from netsuite whose firstname is "Paul"
# 4. Work with messages (support case communications)
discover message from netsuite
retrieve some message records from netsuite whose incoming is "true" and whose hasattachment is "true"
# 5. Get messages for a specific support case and download attachment
retrieve some message records from netsuite whose activity is "1283324"
use the above as the messages
the messages
the code is the message's "attachments"
retrieve an attachment from netsuite
the attachment id is the code
# 6. Create a new contact
discover contact from netsuite
create a json
use the above as the body
set the body's "firstName" to "[KOGNITOS TEST]"
set the body's "lastName" to "PG 1.0.2 Example"
create a contact record in netsuite
the body is the body
# 7. Retrieve all contacts
retrieve some contact records from netsuite
# 8. Filter contacts (note: filtering is case-sensitive)
retrieve some contact records from netsuite whose firstName has "Kognitos"
retrieve some contact records from netsuite whose firstName has "KOGNITOS"
# 9. Update a contact
use the above as the contacts
use the first contact as the contact
set the contact's "lastName" to "Updated PG 2"
update a contact record in netsuite
the record is the contact
# 10. Verify the update
retrieve some contact records from netsuite whose firstName has "KOGNITOS"
Understanding Record Types
NetSuite has three record views for discovered entities:
Preview Records
Retrieve Records, Create Record
Essential fields like ID, name, basic information
Lightweight for listing and selection
Fast — efficient for bulk operations
Detail Records
Retrieve Record Details
All fields including nested data and relationships
Complete record information
Slower — use when you need everything
Create Records
Create Record
Only create-able fields
Defines what you can set when creating
Excludes system-generated and read-only fields
Typical Workflow
Use retrieve to get preview records (fast)
User selects a specific record
Use retrieve details to get complete information (when needed)
Last updated
Was this helpful?