Using Item Records in SuiteScript

This section includes the following topics:

For information about working with items in the UI, see Using Item Records and Item Types.

Loading Item Types

When using record.load(options), you can:

Filtering Items by Type

The following are valid search filter item type IDs. Note that the item filter IDs are case-sensitive.

Item Type IDs

Assembly

Description

Discount

DwnLdItem

EndGroup

GiftCert

Group

InvtPart

Kit

Markup

NonInvtPart

OthCharge

Payment

Service

ShipItem

Subtotal

TaxGroup

TaxItem

To use these IDs:

  1. Create a script that will search for items of a specific type or types (for example, search for all non-inventory items).

  2. Next, see any of the valid SuiteScript item type IDs.

Sample Code

          //Create a script that will search for all non-inventory part items
function searchnoninventorypart()
{
    var searchType = search.Type.NON_INVENTORY_ITEM;
    var mySearch = search.create({
        type: searchType,
        columns: [{
            name: 'internalId'
        }],
        filters: [{
            name: ' ',
            operator: search.Operator.ANYOF, 
            values: 'NonInvtPart'
        }]
    });
} 

        

Looking Up the Subsidiary Field

The search.lookupFields(options) method lets you retrieve the current value of a field on a record. Usually, single select fields are returned as an object with value and text properties. Multiselect fields are returned as an object with a set of value: text pairs.

The subsidiary field on an item record is a multiselect field. However, when you use search.lookupFields(options) to retrieve the value of this field, the field is returned as a single value: text pair instead of a set of pairs. The returned value: text pair represents the first subsidiary in the list.

Advanced Revenue Management Scripting with Items

The item record (internal ID item) contains several additional accounting fields associated with the Advanced Revenue Management (Essentials) and Advanced Revenue Management (Revenue Allocation) features. The following table lists these scriptable fields.

Field

Type

Internal ID

Create Revenue Plans On

List/Record

createrevenueplanson

Item Revenue Category

List/Record

itemrevenuecategory

Revenue Allocation Group

List/Record

revenueallocationgroup

Revenue Recognition Rule

List/Record

revenuerecognitionrule

The Item Revenue Category and Revenue Allocation Group fields appear only when the Advanced Revenue Management (Revenue Allocation) feature is enabled.

Before you begin working with advanced revenue management programmatically, see Setup for Advanced Revenue Management (Essentials) and Setup for Advanced Revenue Management (Revenue Allocation).

For help working with this record in the UI, see Item Configuration for Advanced Revenue Management (Essentials) and (Revenue Allocation).

General Notices