Introduction to Configuration Records in NetSuite

A configuration record in NetSuite is a way to store and manage custom settings. In SuiteCommerce Advanced (SCA), configuration records allow developers to add, edit, and manage configurable settings that users can later adjust through the SuiteCommerce Configuration UI. These settings are helpful when creating reusable and customizable features, such as custom UI components, product display options, and more.

Understanding the configurationManifest.json File

The configurationManifest.json file is a JSON file used to define the settings and configuration fields for an extension or module in SuiteCommerce Advanced. By defining configurations in this file, you create a structured interface where non-developers can modify settings without directly editing code.

The basic structure of configurationManifest.json includes:

  • Setting ID: Unique identifier for each setting.
  • Type: Specifies the data type of the setting (e.g., text, dropdown, boolean).
  • Label: Human-readable name displayed in the SuiteCommerce Configuration UI.
  • Help: Optional description to guide users.
  • Default Value: The pre-configured default value for the setting.

Steps to Create a Configuration Record Using configurationManifest.json

Step 1: Locate or Create the configurationManifest.json File

If you’re working on an existing extension, you’ll likely find the configurationManifest.json file within your extension’s root directory. If you are creating a new extension, follow these steps:

  1. Navigate to the root folder of your extension.
  2. Create a new file named configurationManifest.json.

Step 2: Define Configuration Fields in configurationManifest.json

Within the configurationManifest.json file, define each configurable setting as an object in JSON format. Here’s a breakdown of a typical structure:

json

Copy code
{
  "configuration": [
    {
      "id": "custom_setting_id",
      "type": "text",
      "label": "Custom Setting",
      "help": "This is a description for the custom setting.",
      "default": "Default Value"
    },
    {
      "id": "boolean_setting",
      "type": "boolean",
      "label": "Enable Feature",
      "help": "Turn this feature on or off.",
      "default": true
    },
    {
      "id": "dropdown_setting",
      "type": "enum",
      "label": "Choose an Option",
      "help": "Select an option from the dropdown.",
      "options": [
        { "label": "Option 1", "value": "option_1" },
        { "label": "Option 2", "value": "option_2" }
      ],
      "default": "option_1"
    }
  ]
}

Let’s break down each key attribute:

  • id: A unique string identifier for the setting.
  • type: Specifies the data type (e.g., text, boolean, enum).
  • label: The name that will appear in the NetSuite Configuration UI.
  • help: An optional field for describing the setting.
  • default: The default value when the setting is first loaded.
  • options (for enum type): An array of objects specifying the possible values for dropdown fields, each with a label and value.

Step 3: Deploy the Configuration Record to NetSuite

Once the configurationManifest.json file is defined with the settings you need, it’s time to deploy your extension to NetSuite:

  1. Zip your extension directory.
  2. Log in to NetSuite, navigate to Customizations > Scripting > Script Deployments.
  3. Deploy your extension and verify that it’s enabled in the SuiteCommerce Configuration UI.

Step 4: Access and Edit the Configuration in NetSuite UI

After deploying your extension, you can access and adjust the settings in NetSuite:

  1. Go to Setup > SuiteCommerce Configuration in your NetSuite account.
  2. Select the relevant configuration record to view and edit the settings you defined in configurationManifest.json.
  3. Modify the values as necessary, and save your changes.

These settings will be applied across your SuiteCommerce site, and any changes made will reflect in real time (or after caching refreshes, depending on the configuration).

Example Use Case: Adding a Footer Text Field

Suppose you want to add a customizable footer text field to your SuiteCommerce site, allowing admins to update it without editing code. Here’s how you could define it in configurationManifest.json:

json

Copy code
{
  "configuration": [
    {
      "id": "footer_text",
      "type": "text",
      "label": "Footer Text",
      "help": "Customize the footer text displayed on all pages.",
      "default": "Welcome to Our Store!"
    }
  ]
}

This code snippet creates a text field labeled “Footer Text” with a default message. Admins can modify this text in the SuiteCommerce Configuration UI to suit their preferences.

Best Practices for configurationManifest.json

  1. Use Descriptive Labels and Help Text: Ensure that labels and help texts clearly convey the purpose of each setting.
  2. Choose Appropriate Default Values: Select values that make sense for most users to minimize manual changes post-deployment.
  3. Group Related Settings: Group settings logically to improve organization within the Configuration UI.

Conclusion

The configurationManifest.json file is an efficient way to create configuration records in SuiteCommerce Advanced, allowing you to add, edit, and organize custom settings with ease. By defining these settings in JSON format, you enable non-developers to manage configuration values via NetSuite’s Configuration UI, simplifying the customization process. With a well-structured configuration file, businesses can tailor their SuiteCommerce site to meet specific needs with minimal development time.

Leave a comment

Your email address will not be published. Required fields are marked *