ANS-1073 · SUITESCRIPT DEVELOPMENT

How to Differentiate Between Picking Ticket and Sales Order Records in NetSuite Batch Printing?

Understanding the distinct field sets present on record objects during NetSuite batch print operations can help identify whether a picking ticket or a sales order is being processed.

Short answer

When processing records during NetSuite batch printing, picking tickets and sales orders exhibit different sets of available fields. By inspecting the fields present on the record object, developers can programmatically determine the record type, allowing for conditional logic in SuiteScript 2.x user event scripts.

Scenario

A NetSuite user event script needs to perform different actions based on whether a batch print operation is being executed for a picking ticket or a sales order. The challenge lies in programmatically identifying the specific record type being processed within the script context.

Solution

To differentiate between picking ticket and sales order records during a batch print operation, an investigation into the record object's available fields can be performed.

  1. Inspect the Record Object: In a SuiteScript 2.x user event script, the record object can be accessed via context.newRecord. Logging this object reveals its structure and available fields.

  2. Identify Field Discrepancies: Through debugging, it was observed that record instances for picking tickets and sales orders, despite having similar general behavior, possess different sets of fields.The fields identified on a picking ticket record during batch print were:

var pickingTicketFields ["storeorder", "credholdoverride", "edition", "prevdate", "weekendpreference", "nlsub", "location", "entity", "origtotal", "nluser", "leadsource", "nexus_country", "type", "exchangerate", "balance", "companyid", "custbody_fulfillment_status", "tobefaxed", "shipaddressee", "canbeunapproved", "ordrecvd", "credholdentity", "linked", "checkcommitted", "oldrevenuecommitment", "shipzip", "itemshippingcostfxrate", "status", "shipstate", "shipcity", "nexus", "primarycurrency", "custbody_customer_number", "balreadyrefunded", "entityfieldname", "primarycurrencyfxrate", "createddate", "shipaddr1", "nlapiCC", "hasfedexfreightservice", "cleared", "custbody_oe_page", "dbstrantype", "statusRef", "isonlinetransaction", "shipaddress", "entityname", "webstore", "subsidiary", "nsapiCT", "nlloc", "tranid", "orderstatus", "shipcomplete", "memo", "billaddress", "custbody_print", "version", "currencyprecision", "currency", "lastmodifieddate", "id", "shipoverride", "voided", "isbasecurrency", "ntype", "accountnumber", "consolidatebalance", "tobeprinted", "shipcountry", "nlrole", "manualcredithold", "nldept", "custbody_printed", "trandate", "baserecordtype", "overallbalance", "shipdate", "linkedclosedperioddiscounts", "custbody_invoice_complete", "shipisresidential", "saleseffectivedate", "*eml_nkey*", "entitynexus", "custbody_line_items", "custbody_created_by", "custbody_pick", "tobeemailed"];

The fields identified on a sales order record during batch print were:

var salesOrderFields ["total", "nlsub", "leadsource", "nluser", "nexus_country", "exchangerate", "billzip", "tobefaxed", "canbeunapproved", "ordrecvd", "credholdentity", "iseditbilledtransactionwithpromotion", "oldrevenuecommitment", "itemshippingcostfxrate", "shipzip", "billaddressee", "nexus", "custbody_customer_number", "createddate", "subtotal", "billcountry", "nlapiCC", "shipaddr1", "cleared", "dbstrantype", "billcity", "statusRef", "isonlinetransaction", "entityname", "shipaddress", "webstore", "billoverride", "nsapiCT", "orderstatus", "memo", "billaddress", "custbody_print", "version", "currency", "currencyprecision", "isbasecurrency", "manualcredithold", "nldept", "shipcountry", "nsapiRC", "origtotal2", "shipdate", "shipisresidential", "saleseffectivedate", "istransformedbill", "entitynexus", "custbody_created_by", "custbody_pick", "edition", "credholdoverride", "storeorder", "prevdate", "weekendpreference", "location", "entity", "nsapiPI", "origtotal", "type", "balance", "companyid", "estgrossprofitpercent", "custbody_fulfillment_status", "shipaddressee", "linked", "checkcommitted", "unbilledorders", "totalcostestimate", "shipcity", "shipstate", "status", "primarycurrency", "entityfieldname", "balreadyrefunded", "primarycurrencyfxrate", "hasfedexfreightservice", "custbody_oe_page", "subsidiary", "islegacypromo", "nlloc", "tranid", "shipcomplete", "lastmodifieddate", "id", "shipoverride", "voided", "ntype", "accountnumber", "consolidatebalance", "nlrole", "tobeprinted", "custbody_printed", "trandate", "billstate", "baserecordtype", "overallbalance", "linkedclosedperioddiscounts", "custbody_invoice_complete", "*eml_nkey*", "custbody_line_items", "estgrossprofit", "billaddr1", "tobeemailed"];

A comparison function can be used to identify fields unique to one record type. For example, fields found only on batch print sales orders include:

var differentFields ["total", "billzip", "iseditbill

Expert NetSuite Support

Need help with this NetSuite issue?

SuiteScript Development consulting and configuration support

Talk to a consultant