addRuleset()

The addRuleset() function (client-side) lets you add NetSuite CPQ building blocks to the current configuration session. The following building blocks are available:

Note:

If the rule property matches answers users selected on the product interface, the building block will be activated and processed. However, the building block only exists for the current configuration session and it isn't saved in your NetSuite account.

The addRuleset() function accepts an object as a parameter. In the object, the core property is type, which specifies the building block to add. The available and required properties change depending on the type you choose. Some properties can take resolve expressions {Q/A} as values. For more information about resolve expressions, see Obtaining Answer Data with Resolve Expressions.

Syntax

Use this syntax for the addRuleset() function:

            addRuleset({
    type: string,
    // Additional properties
}); 

          

Type Property Values

Note:

The type property is required.

The type property can take one of the values included in the table. Each value corresponds to a building block. The rest of the properties changes based on the value of type.

Type Value

NetSuite CPQ Record

item

Additional item record

material

Material record

pricing

Pricing record

routing

Routing step record

validation

Validation record

Additional Item Properties

Note:

The name property is required. You must also specify at least one of these properties: item, itemid, or itemQA.

By assigning item as a value to the type property, you can work with an additional item and the properties included in this table. Unless otherwise indicated, properties represents fields on the additional item record. Under the Description column, field names are marked in bold. For more information about additional items, see Including Additional Items Related to the Configurable Item.

Property

Data Type

Description

item

string

Item field

itemid

string

Item Name/Number field (item record)

itemQA

string

Resolve Item Name/Number field

Note:

You can use resolve expressions.

colmap

string

Sets transaction line fields.

Note:

You can use resolve expressions.

cost

number | string

Average Cost field

Note:

The information is sourced from the item record and displayed under Audit menu > Additional Items on the product interface.

desc

string

Description field

Note:

You can use resolve expressions.

ext

number

Total Cost field (Total Quantity * Average Cost)

The information is displayed under Audit menu > Additional Items on the product interface.

id

string

Record ID

name

string

Name field

price

number | string

Price field

Note:

You can use resolve expressions.

pricemul

number | string

Price Multiplier field

Note:

You can use resolve expressions.

qty

number | string

Quantity field

rule

string

Rule field

sequence

number | string

Sequence Number field

On the Audit menu, the Name column sources the content from the name property. The Item Name/Number and Display Name/Code columns sources their values from the corresponding fields on the item record.

Material Properties

Note:

The name property is required. You must also specify at least one of these properties: item, itemid, or itemQA.

By assigning material as a value to the type property, you can work with a material and the properties included in this table. Unless otherwise indicated, properties represents fields on the material record. Under the Description column, field names are marked in bold. For more information about materials, see Defining Materials for the Configurable Item.

Property

Data Type

Description

item

string

Item field

itemid

string

Item Name/Number field (item record)

itemPrice

true | false

Creates a pricing record associated with the material for the current configuration session. The price is sourced from the item record associated with the material. See Include Prices when Adding Materials.

itemQA

string

Resolve Item Name/Number field

Note:

You can use resolve expressions.

cancel_date

string

Effective End Date field

cat

string

Rule Category internal ID

The category assigned to the material

colmap

string

Sets work order line fields.

Note:

You can use resolve expressions.

comp_yield

string

Component Yield field

Note:

You can use resolve expressions.

cost

number | string

Average Cost field

Note:

The information is sourced from the item record and displayed under Audit menu > Materials on the product interface.

crule

string

Rule field of the category assigned to the material

desc

string

Description

effective_date

string

Effective Start Date field

ext

number

Total Cost field (Total Quantity * Average Cost)

The information is displayed under Audit menu > Materials on the product interface.

mult

number | string

Quantity Multiplier field

name

string

Name field

phantom

'T' | 'F' (true or false)

Phantom Material field

purprice

number | string

Purchase Price field

qty

number | string

Quantity field

route

string

Routing Step field

rule

string

Rule field

units

string

Primary Units Type field

Note:

You can use resolve expressions.

uom

string

Primary Sale Unit field

On the Audit menu, the Name column sources the content from the name property. The Item Name/Number and Display Name/Code columns sources their values from the corresponding fields on the item record.

Pricing Record Properties

Note:

The name property is required.

By assigning pricing as a value to the type property, you can work with a pricing record and the properties included in this table. Unless otherwise indicated, properties represents fields on the pricing record. Under the Description column, field names are marked in bold. For more information about pricing records, see Calculating the Final Pricing for the Configurable Item.

Property

Data Type

Description

cancel_date

string

Effective End Date field

cat

string

Rule Category internal ID

The category assigned to the pricing record

crule

string

Rule field of the category assigned to the pricing record

discount

number | string

Discount field

Note:

You can use resolve expressions.

effective_date

string

Effective Start Date field

hide

'T' | 'F' (true or false)

Hide price amount field

hideline

'T' | 'F' (true or false)

Hide price line field

html

string

Label field

multiplier

number | string

Price Multiplier field

Note:

You can use resolve expressions.

name

string

Name field

otc

'T' | 'F' (true or false)

One Time Charge field

price

number | string

Price field

Note:

You can use resolve expressions.

recalc

'T' | 'F' (true or false)

Calculate subtotal field

rule

string

Rule field

sequence

number | string

Sequence Number field

Routing Step Properties

Note:

The name property is required.

By assigning routing as a value to the type property, you can work with a routing step and the properties included in this table. Unless otherwise indicated, properties represents fields on the routing step record. Under the Description column, field names are marked in bold. For more information about routing steps, see Defining Routing Steps to Build the Configurable Item.

Name

Data Type

Description

am_bmax

string

Batch Maximum field

am_bmin

string

Batch Minimum field

am_conc

string

Concurrent Assets (Split Order) field

am_hold

string

Hold Time (min) field

am_incqty

string

Incremental QTY field

am_lag

string

Lag value field

am_lagtype

string

Lag Type field

am_opername

string

Operation Name field

am_pnotes

string

Process Notes field

am_proctype

string

Process Type field

am_suffix

string

AM workbench name suffix

am_uom

string

Unit of Measure field

cancel_date

string

Effective End Date field

code

string

Code field

comments

string

Comments field

Note:

You can use resolve expressions.

description

string

Description field

effective_date

string

Effective date field

mct

string

Manufacturing Cost Template internal ID

mwc

string

Manufacturing Work Center internal ID

mwclabel

string

Manufacturing Work Center name

The name is displayed under the Audit menu > Routing Steps option

name

string

Name field

opseq

number | string

Operation Sequence field

Note:

You can use resolve expressions.

rrate

number | string

Run Rate field

Note:

You can use resolve expressions.

rule

number | string

Rule field

stime

number | string

Setup Time field

Note:

You can use resolve expressions.

Validation Properties

Note:

The name property is required.

By assigning validation as a value to the type property, you can work with a validation message and the properties included in this table. Unless otherwise indicated, properties represents fields on the validation message record. Under the Description column, field names are marked in bold. For more information about validation messages, see Displaying Validation Messages on the User Interface.

Property

Data Type

Description

validationType

string

Type field

Available values:

  • Note - 'customlist_cpqc_list_validation_types_note'.

  • Incomplete configuration - 'customlist_cpqc_list_validation_types_incomplete_conf'.

  • Incompatible configuration - 'customlist_cpqc_list_validation_types_incompatible_conf'.

cancel_date

string

Effective End Date field

cat

string

Rule Category internal ID

The category assigned to the validation

crule

string

Rule field of the category assigned to the validation message

effective_date

string

Effective Start Date field

message

string

Message field

Note:

You can use resolve expressions.

name

string

Name field

rule

string

Rule field

seq

number | string

Sequence Number field

Examples

The following examples show how to use the addRuleset() function.

Adding a Material

This example adds a material to the configuration.

              addRuleset({
    type: 'material',
    name: 'Wooden Desk Top',
    rule: '*/*',
    item: 'DESK-TOP-AB02',
    qty: '1'
}); 

            

Displaying a Validation Message

This example displays a validation message to users.

              addRuleset({
    type: 'validation',
    validationType: 'Note',
    name: 'Paints for metal frames',
    rule: '*/*',
    message: 'Water-base paints aren't available for metal frames'
}); 

            

Adding a Price

This example adds a price to the calculations for the total price of the configured item.

              addRuleset({
    type: 'pricing',
    name: 'Cherry desk top',
    rule: '*/*',
    price: '800',
    sequence: 15
}); 

            

Include Prices when Adding Materials

When adding materials to the configuration, you can automatically create the associated pricing records for the current configuration session. To create and link a pricing record to the material, set the itemPrice property to true. See the following example:

            addRuleset({
    type: 'material',
    item: '859',
    rule: '*/*',
    itemPrice: true
}); 

          
Note:

The itemPrice property is available only when type is material.

The material price label will be sourced from the itemname or name properties of the material. See this example:

            addRuleset({
    type: 'material',
    item: '859',
    itemname: 'Desk side panel',
    rule: '*/*',
    itemPrice: true
}); 

          

If both itemname and name are specified, itemname is used. If both are omitted, the Display Name/Code field from the item record is used. If Display Name/Code is blank, the material price will have no label, but the amount will still be displayed on the product interface.

On the product interface, the material price will be displayed in the Audit menu > Pricing option and the Summary. It will also be included in the Total for the configured item.

Related Topics

General Notices