Price Rule

Use a price rule to set prices for groups of items. For example, you could specify a group of items to sell at a discount during an upcoming sale event.

The record ID for a price rule record is pricerule. This record contains one subrecord, with record ID customerdimension.

See the SuiteScript Records Browser for all internal IDs associated with this record.

Note:

For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.

For information about scripting with this record in SuiteScript, see the following help topics:

Supported Script Types

The price rule record is scriptable in server and client SuiteScript.

All three user events are supported: beforeLoad, beforeSubmit, and afterSubmit.

Supported Functions

The price rule record is partially scriptable. It can be read, created, updated, copied, and deleted using SuiteScript. Search and transform scripting is not supported.

Prerequisites

You must enable Advanced Pricing before you can use this record through SuiteScript.

Usage Notes

Base Price Rule and Creating Price Rule cannot be inactive when you use this record through SuiteScript. There can be only one purchase price for an item.

Code Sample

The following sample shows how to create a new price rule.

            require(['N/record'], function(record) {
    var priceRule = record.create({
        type: "pricerule",
        isDynamic: true
    });
    priceRule.setValue({
        fieldId: "name",
        value: "TestPriceRule"
    });
    priceRule.setValue({
        fieldId: "priority",
        value: 1
    });
    priceRule.insertLine({
        sublistId: "customerdimension",
        line: 0
    });
    priceRule.setCurrentSublistValue({
        sublistId: "customerdimension",
        fieldId: "isincluded",
        value: true
    });
    priceRule.setCurrentSublistValue({
        sublistId: "customerdimension",
        fieldId: "customer",
        value: 4
    });
    priceRule.commitLine({sublistId:"customerdimension"});
    log.debug(priceRule.save());
}); 

          

General Notices