getRuleset()

The getRuleset() function (client-side) lets you retrieve detailed data for the following NetSuite CPQ building blocks:

Syntax

Use this syntax for the getRuleset() function:

            getRuleset(buildingBlockName, getAll); 

          

Return Value

The getRuleset() function returns all active building blocks of the specified type along with their data. If getAll is set to true, it also returns inactive building block instances. Inactive building blocks have a rule that doesn't match any answer selected by users on the product interface.

Parameters

Note:

The buildingBlockName parameter is required.

The getRuleset() function accepts the following parameters:

  • buildingBlockName (string) - The name of the building block to retrieve, such as question, answer, or material. The buildingBlockName parameter can take one of the values included in the table.

    Type Value

    Record

    questions

    Question record

    answers

    Answer record

    items

    Additional item record

    materials

    Material record

    pricings

    Pricing record

    routings

    Routing step record

    validations

    Validation record

  • getAll - If true, getRuleset() retrieves also inactive building block instances that aren't included in the Audit menu. Inactive building blocks have a rule that doesn't match any answer selected by users on the product interface.

Examples

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

Retrieving Building Blocks

This example retrieves additional items that are part of your configuration.

              const items = getRuleset('items');
console.log(items); 

            

The function returns an array of additional item objects, each providing details such as the internal ID, the item name/number, quantity, and description. In this example, the first record contains a cable description, while the second references a bike tube item with quantity and price information.

              [
  {
        "id": "1902",
        "item": "",
        "ext": 0,
        "itemid": "",
        "itemQA": "",
        "qty": 1,
        "price": "0",
        "desc": "Computer cables BC2300",
        "colmap": "",
        "pricemul": "1"
    },
    {
        "id": "1903",
        "item": "1290",
        "ext": 0,
        "itemid": "BIKE.TUBE26",
        "itemQA": "",
        "qty": 1,
        "price": "5",
        "desc": "",
        "colmap": "",
        "pricemul": "",
        "itemQA_res": "BIKE.TUBE26"
    }
] 

            

Retrieving the Context of a Product

This example retrieves the context of a product by setting the getAll parameter to true.

              const contextData = getRuleset('context', true); 

            

The output provides information about the session, user, company, role, settings for multicurrency, and date formats. This information is helpful for understanding the current environment and user session.

              {
    "SOLE/USER": 1234,
    "SOLE/COMPID": "1234567",
    "SOLE/USER_NAME": "customer name",
    "SOLE/USER_EMAIL": "customer.name@netsuite.com",
    "SOLE/USER_ROLE": 3,
    "SOLE/USER_DEPARTMENT": 0,
    "SOLE/USER_LOCATION": 0,
    "SOLE/ROLECENTER": "BASIC",
    "SOLE/ROLEID": "administrator",
    "NS/SETTING_MULTICURRENCY": true,
    "dateFormat": "M/D/YYYY",
    "redwood": true
} 

            

Related Topics

General Notices