Custom Records
Custom Records allow you to create new data structures in NetSuite to store business information that doesn't fit standard records.
When to Use Custom Records
| Use Case | Example |
|---|---|
| Tracking data | Approval history, audit logs |
| Configuration | Settings, thresholds, mappings |
| Master data | Product specifications, vendor certifications |
| Workflow data | Approval requests, task assignments |
| Integration data | External system references |
Custom Record Architecture
┌─────────────────────────────────────────────────────────────────────────────┐
│ CUSTOM RECORD STRUCTURE │
└─────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────┐
│ CUSTOM RECORD TYPE (Definition) │
│ customrecord_invoice_approval │
│ ────────────────────────────────────────────────────────────────│
│ • Record name │
│ • Permissions │
│ • Features (sublists, numbering, etc.) │
└──────────────────────────────────────────────────────────────────┘
│
│ Contains
▼
┌──────────────────────────────────────────────────────────────────┐
│ CUSTOM FIELDS (Definition) │
│ ────────────────────────────────────────────────────────────────│
│ custrecord_ia_invoice │ SELECT (Invoice) │
│ custrecord_ia_status │ SELECT (Custom List) │
│ custrecord_ia_approver │ SELECT (Employee) │
│ custrecord_ia_notes │ TEXTAREA │
│ custrecord_ia_amount │ CURRENCY │
│ custrecord_ia_date │ DATE │
└──────────────────────────────────────────────────────────────────┘
│
│ Creates instances
▼
┌──────────────────────────────────────────────────────────────────┐
│ RECORD INSTANCES (Data) │
│ ────────────────────────────────────────────────────────────────│
│ ID: 1 │ Invoice: INV-001 │ Status: Pending │ Amount: $5,000 │
│ ID: 2 │ Invoice: INV-002 │ Status: Approved │ Amount: $2,500 │
│ ID: 3 │ Invoice: INV-003 │ Status: Rejected │ Amount: $10,000 │
└──────────────────────────────────────────────────────────────────┘
Custom Record XML Structure
<?xml version="1.0" encoding="UTF-8"?>
<customrecordtype scriptid="customrecord_invoice_approval">
<!-- Basic Settings -->
<recordname>Invoice Approval</recordname>
<description>Tracks invoice approval requests</description>
<!-- Display Options -->
<includename>T</includename> <!-- Include Name field -->
<showid>T</showid> <!-- Show internal ID -->
<shownotes>T</shownotes> <!-- Show notes subtab -->
<showinlist>T</showinlist> <!-- Show in Lists menu -->
<!-- Permissions -->
<accesstype>USEPERMISSIONLIST</accesstype>
<!-- Numbering -->
<numberingprefix>IA-</numberingprefix>
<numberingsuffix></numberingsuffix>
<numberingmindigits>4</numberingmindigits>
<numberinginit>1</numberinginit>
<!-- Record Permissions -->
<recordstype>RECORDS_ONLY</recordstype>
<!-- Custom Fields -->
<customrecordcustomfields>
<customrecordcustomfield scriptid="custrecord_ia_invoice">
<label>Invoice</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>-30</selectrecordtype> <!-- Invoice -->
<ismandatory>T</ismandatory>
<displaytype>NORMAL</displaytype>
</customrecordcustomfield>
<customrecordcustomfield scriptid="custrecord_ia_status">
<label>Approval Status</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>[customlist_approval_status]</selectrecordtype>
<ismandatory>T</ismandatory>
<defaultvalue>1</defaultvalue>
</customrecordcustomfield>
<customrecordcustomfield scriptid="custrecord_ia_approver">
<label>Approver</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>-4</selectrecordtype> <!-- Employee -->
<ismandatory>T</ismandatory>
</customrecordcustomfield>
<customrecordcustomfield scriptid="custrecord_ia_amount">
<label>Amount</label>
<fieldtype>CURRENCY</fieldtype>
<ismandatory>F</ismandatory>
</customrecordcustomfield>
<customrecordcustomfield scriptid="custrecord_ia_date">
<label>Request Date</label>
<fieldtype>DATE</fieldtype>
<defaultvalue>TODAY</defaultvalue>
</customrecordcustomfield>
<customrecordcustomfield scriptid="custrecord_ia_notes">
<label>Notes</label>
<fieldtype>TEXTAREA</fieldtype>
<ismandatory>F</ismandatory>
</customrecordcustomfield>
<customrecordcustomfield scriptid="custrecord_ia_approved_by">
<label>Approved By</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>-4</selectrecordtype>
<displaytype>INLINE</displaytype>
</customrecordcustomfield>
<customrecordcustomfield scriptid="custrecord_ia_approved_date">
<label>Approved Date</label>
<fieldtype>DATETIME</fieldtype>
<displaytype>INLINE</displaytype>
</customrecordcustomfield>
</customrecordcustomfields>
<!-- Role Permissions -->
<permissions>
<permission>
<permittedlevel>FULL</permittedlevel>
<permittedrole>ADMINISTRATOR</permittedrole>
</permission>
<permission>
<permittedlevel>EDIT</permittedlevel>
<permittedrole>CUSTOMROLE_APPROVER</permittedrole>
</permission>
<permission>
<permittedlevel>VIEW</permittedlevel>
<permittedrole>CUSTOMROLE_VIEWER</permittedrole>
</permission>
</permissions>
</customrecordtype>
Field Types Reference
┌─────────────────────────────────────────────────────────────────────────────┐
│ CUSTOM FIELD TYPES │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────┬────────────────────────────────────────────────────────┐
│ Type │ Description & XML Example │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ TEXT │ Single-line text │
│ │ <fieldtype>TEXT</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ TEXTAREA │ Multi-line text │
│ │ <fieldtype>TEXTAREA</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ DATE │ Date only │
│ │ <fieldtype>DATE</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ DATETIME │ Date and time │
│ │ <fieldtype>DATETIME</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ INTEGER │ Whole numbers │
│ │ <fieldtype>INTEGER</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ FLOAT │ Decimal numbers │
│ │ <fieldtype>FLOAT</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ CURRENCY │ Currency amounts │
│ │ <fieldtype>CURRENCY</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ PERCENT │ Percentage values │
│ │ <fieldtype>PERCENT</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ CHECKBOX │ True/False │
│ │ <fieldtype>CHECKBOX</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ SELECT │ Dropdown list │
│ │ <fieldtype>SELECT</fieldtype> │
│ │ <selectrecordtype>-4</selectrecordtype> (Employee) │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ MULTISELECT │ Multi-select list │
│ │ <fieldtype>MULTISELECT</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ RICHTEXT │ HTML editor │
│ │ <fieldtype>RICHTEXT</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ EMAIL │ Email address │
│ │ <fieldtype>EMAIL</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ PHONE │ Phone number │
│ │ <fieldtype>PHONE</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ URL │ Web address │
│ │ <fieldtype>URL</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ IMAGE │ Image file │
│ │ <fieldtype>IMAGE</fieldtype> │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ DOCUMENT │ File attachment │
│ │ <fieldtype>DOCUMENT</fieldtype> │
└─────────────────────┴────────────────────────────────────────────────────────┘
Select Field Record Types
Common internal IDs for <selectrecordtype>:
| Record Type | Internal ID |
|---|---|
| Customer | -2 |
| Employee | -4 |
| Vendor | -3 |
| Contact | -6 |
| Item | -10 |
| Transaction | -30 |
| Sales Order | 17 |
| Invoice | -30 |
| Purchase Order | 15 |
| Custom List | [customlist_scriptid] |
| Custom Record | [customrecord_scriptid] |
Working with Custom Records in Scripts
Create a Custom Record
const record = require('N/record');
const createApprovalRequest = (invoiceId, approverId, amount) => {
const approval = record.create({
type: 'customrecord_invoice_approval',
isDynamic: true
});
approval.setValue({ fieldId: 'custrecord_ia_invoice', value: invoiceId });
approval.setValue({ fieldId: 'custrecord_ia_approver', value: approverId });
approval.setValue({ fieldId: 'custrecord_ia_amount', value: amount });
approval.setValue({ fieldId: 'custrecord_ia_status', value: 1 }); // Pending
approval.setValue({ fieldId: 'custrecord_ia_date', value: new Date() });
const approvalId = approval.save();
return approvalId;
};
Load and Update a Custom Record
const updateApprovalStatus = (approvalId, newStatus, notes) => {
record.submitFields({
type: 'customrecord_invoice_approval',
id: approvalId,
values: {
'custrecord_ia_status': newStatus,
'custrecord_ia_notes': notes,
'custrecord_ia_approved_by': runtime.getCurrentUser().id,
'custrecord_ia_approved_date': new Date()
}
});
};
Search Custom Records
const search = require('N/search');
const findPendingApprovals = (approverId) => {
const approvalSearch = search.create({
type: 'customrecord_invoice_approval',
filters: [
['custrecord_ia_status', 'anyof', 1], // Pending
'AND',
['custrecord_ia_approver', 'anyof', approverId]
],
columns: [
'custrecord_ia_invoice',
'custrecord_ia_amount',
'custrecord_ia_date',
'custrecord_ia_notes'
]
});
const results = [];
approvalSearch.run().each((result) => {
results.push({
id: result.id,
invoice: result.getText('custrecord_ia_invoice'),
amount: result.getValue('custrecord_ia_amount'),
date: result.getValue('custrecord_ia_date')
});
return true;
});
return results;
};
Delete a Custom Record
const deleteApproval = (approvalId) => {
record.delete({
type: 'customrecord_invoice_approval',
id: approvalId
});
};
Complete Example: Approval Tracking Record
XML Definition
src/Objects/customrecord_invoice_approval.xml
<?xml version="1.0" encoding="UTF-8"?>
<customrecordtype scriptid="customrecord_invoice_approval">
<recordname>Invoice Approval</recordname>
<description>Tracks invoice approval workflow</description>
<!-- Display Settings -->
<includename>T</includename>
<showid>T</showid>
<shownotes>T</shownotes>
<showinlist>T</showinlist>
<enablemailmerge>F</enablemailmerge>
<enablenumberingoverride>F</enablenumberingoverride>
<!-- Icon and Appearance -->
<iconbuiltin>T</iconbuiltin>
<iconindex>24</iconindex>
<!-- Numbering -->
<allowinlineediting>T</allowinlineediting>
<allowinlinedeleting>F</allowinlinedeleting>
<allowquicksearch>T</allowquicksearch>
<!-- Access Control -->
<accesstype>USEPERMISSIONLIST</accesstype>
<!-- Fields -->
<customrecordcustomfields>
<!-- Invoice Reference -->
<customrecordcustomfield scriptid="custrecord_ia_invoice">
<label>Invoice</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>-30</selectrecordtype>
<ismandatory>T</ismandatory>
<displaytype>NORMAL</displaytype>
<showinlist>T</showinlist>
</customrecordcustomfield>
<!-- Status -->
<customrecordcustomfield scriptid="custrecord_ia_status">
<label>Status</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>[customlist_approval_status]</selectrecordtype>
<ismandatory>T</ismandatory>
<defaultvalue>1</defaultvalue>
<showinlist>T</showinlist>
</customrecordcustomfield>
<!-- Approver -->
<customrecordcustomfield scriptid="custrecord_ia_approver">
<label>Assigned Approver</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>-4</selectrecordtype>
<ismandatory>T</ismandatory>
<showinlist>T</showinlist>
</customrecordcustomfield>
<!-- Amount -->
<customrecordcustomfield scriptid="custrecord_ia_amount">
<label>Amount</label>
<fieldtype>CURRENCY</fieldtype>
<ismandatory>F</ismandatory>
<showinlist>T</showinlist>
</customrecordcustomfield>
<!-- Request Date -->
<customrecordcustomfield scriptid="custrecord_ia_request_date">
<label>Request Date</label>
<fieldtype>DATETIME</fieldtype>
<defaultvalue>NOW</defaultvalue>
<showinlist>T</showinlist>
</customrecordcustomfield>
<!-- Due Date -->
<customrecordcustomfield scriptid="custrecord_ia_due_date">
<label>Due Date</label>
<fieldtype>DATE</fieldtype>
<ismandatory>F</ismandatory>
</customrecordcustomfield>
<!-- Priority -->
<customrecordcustomfield scriptid="custrecord_ia_priority">
<label>Priority</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>[customlist_priority]</selectrecordtype>
<defaultvalue>2</defaultvalue>
</customrecordcustomfield>
<!-- Notes -->
<customrecordcustomfield scriptid="custrecord_ia_notes">
<label>Notes</label>
<fieldtype>TEXTAREA</fieldtype>
<ismandatory>F</ismandatory>
</customrecordcustomfield>
<!-- Approval Information -->
<customrecordcustomfield scriptid="custrecord_ia_approved_by">
<label>Approved/Rejected By</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>-4</selectrecordtype>
<displaytype>INLINE</displaytype>
</customrecordcustomfield>
<customrecordcustomfield scriptid="custrecord_ia_action_date">
<label>Action Date</label>
<fieldtype>DATETIME</fieldtype>
<displaytype>INLINE</displaytype>
</customrecordcustomfield>
<customrecordcustomfield scriptid="custrecord_ia_rejection_reason">
<label>Rejection Reason</label>
<fieldtype>TEXTAREA</fieldtype>
<displaytype>NORMAL</displaytype>
</customrecordcustomfield>
</customrecordcustomfields>
<!-- Permissions -->
<permissions>
<permission>
<permittedlevel>FULL</permittedlevel>
<permittedrole>ADMINISTRATOR</permittedrole>
</permission>
<permission>
<permittedlevel>EDIT</permittedlevel>
<permittedrole>A/P CLERK</permittedrole>
</permission>
</permissions>
</customrecordtype>
Record Relationship Flow
┌─────────────────────────────────────────────────────────────────────────────┐
│ CUSTOM RECORD RELATIONSHIPS │
└─────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────┐
│ INVOICE (Standard Record) │
│ ────────────────────────────────────────────────────────────────│
│ ID: 12345 │
│ Number: INV-001 │
│ Amount: $5,000 │
└──────────────────────────────┬───────────────────────────────────┘
│
Referenced by custrecord_ia_invoice
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ INVOICE APPROVAL (Custom Record) │
│ ────────────────────────────────────────────────────────────────│
│ ID: 1 │
│ Invoice: INV-001 (12345) │
│ Status: Pending │
│ Approver: John Smith (567) │
│ Amount: $5,000 │
└──────────────────────────────┬───────────────────────────────────┘
│
custrecord_ia_status references
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ APPROVAL STATUS (Custom List) │
│ ────────────────────────────────────────────────────────────────│
│ 1: Pending │
│ 2: Approved │
│ 3: Rejected │
└──────────────────────────────────────────────────────────────────┘
Import Existing Records
To import an existing custom record from NetSuite:
# Via terminal
suitecloud object:import --type customrecordtype --destinationfolder Objects
# Or via VSCode
Ctrl+Shift+P → SuiteCloud: Import Objects
→ Select "Custom Record Type"
→ Select records to import
Best Practices
| Practice | Description |
|---|---|
| Meaningful IDs | Use descriptive scriptids: customrecord_invoice_approval |
| Field prefixes | Use consistent prefix: custrecord_ia_* |
| Permissions | Define appropriate role access |
| Relationships | Link to parent records via SELECT fields |
| Validation | Add required fields appropriately |
| Indexing | Enable for frequently searched fields |
Common Patterns
Parent-Child Records
<!-- Child record that links to parent -->
<customrecordcustomfield scriptid="custrecord_child_parent">
<label>Parent Record</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>[customrecord_parent]</selectrecordtype>
<ismandatory>T</ismandatory>
</customrecordcustomfield>
Self-Referencing (Hierarchy)
<!-- Record that can reference itself -->
<customrecordcustomfield scriptid="custrecord_org_parent">
<label>Parent Organization</label>
<fieldtype>SELECT</fieldtype>
<selectrecordtype>[customrecord_organization]</selectrecordtype>
<ismandatory>F</ismandatory>
</customrecordcustomfield>
Next Steps
- Custom Fields - Add fields to standard records
- Custom Lists - Create dropdown options
- Invoice Approval Scenario - See custom records in action