Netsuite.cru -
netsuite.cru typically refers to a Crystal Reports definition file that has been integrated or exported for use within the Oracle NetSuite ecosystem. The .cru extension denotes a binary file structure used by Crystal Reports to store report layouts, data source connections, and formula logic.
In the context of NetSuite, this file serves as a bridge between the ERP’s backend data architecture and external or embedded reporting tools, allowing for advanced financial formatting not natively available in the standard SuiteAnalytics or PDF/HTML rendering engines.
Creating a record is the most common operation. You initialize a new record, set field values, and submit it. netsuite.cru
Basic Example: Creating a Sales Order
/** * @NApiVersion 2.1 * @NScriptType MapReduceScript */ define(['N/record'], (record) => const createSalesOrder = () => try let salesOrder = record.create( type: record.Type.SALES_ORDER, isDynamic: true // Allows field-by-field setting );salesOrder.setValue( fieldId: 'entity', value: 123 // Internal ID of the customer ); salesOrder.setValue( fieldId: 'tranid', value: 'SO-EXT-001' // External ID to prevent duplicates ); let newOrderId = salesOrder.save(); log.debug('Order Created', `New Sales Order ID: $newOrderId`); catch (e) log.error('Error', e.message); ; return execute: createSalesOrder ;
);
Pro Tip: Always use isDynamic: true when you need conditional fields or sublist logic. For simple data injection, isDynamic: false is faster. netsuite
To store audit logs, create a custom record with these fields:
| Field ID | Type | Purpose |
|----------|------|---------|
| custrecord_affected_record | Integer (Record reference) | Stores the ID of the record being changed |
| custrecord_operation | Text (List: CREATE, UPDATE, DELETE) | Type of CRU operation |
| custrecord_performed_by | Integer (Employee reference) | User who performed operation |
| custrecord_timestamp | Date/Time | When operation occurred | Pro Tip: Always use isDynamic: true when you
This is an example of what a typical custom record script file looks like in a NetSuite account customizing a "CRU" (Custom Record Usage) object:
/**
* @NApiVersion 2.x
* @NScriptType customrecord
*/
define([], function()
/**
* Defines the Custom Record script.
* This script is attached to a custom record type.
*/
return
// custom record scripts do not typically have entry points like beforeLoad or afterSubmit
// unless they are implementing specific plugins or workflow actions.
// This is a placeholder for the definition file.
;
);