Configuration Modification Schema
This section describes the configuration modification schema. Follow these steps to create a JSON modification file.
Step 1: Add the Type Object
The type specifies the type of object defined by the configuration file. The value of this object must always be set to object
. This is required to be compliant with the JSON schema specification.
{
"type": "object",
}
Step 2: Add the Modifications Array
When you deploy to NetSuite, the developer tools use the modifications listed in this array to create the configurationManifest.json. Each modifications
object requires the target and action components. Some actions require an addition value component.
This declares the modifications to include when you deploy to NetSuite.
{
"type": "object",
"modifications": [
]
}
Step 3: Add the Target Attribute
The target attribute contains a string representing a JSONPath query. The elements returned are the targets to be affected by the action. In this example, when you deploy your customizations, the JSONPath query searches for the enum
property of the target addToCartBehavior
property.
{
"type": "object",
"modifications": [
{
"target": "$.properties.addToCartBehavior.enum",
}
]
}
For more information about how to build a target JSONPath query, see https://github.com/s3u/JSONPath.
Step 4: Add the Action Attribute
The action attribute indicates the operation to apply over each element of the target returned by the JSONPath query. Possible actions are:
-
add – adds a new element to the user interface, such as a value, a property, or an option. Only object, array, or string elements can be returned by the target query when using the add action, and each type results in a different behavior.
-
replace – overwrites values in a configuration file. The target query can only return a number, string, boolean, or null.
-
remove – deletes an element from an array. The target query only can return a number, string, boolean, or null inside an array.
This example includes the add
action.
{
"type": "object",
"modifications": [
{
"target": "$.properties.addToCartBehavior.enum",
"action": "add",
}
]
}
Step 5: Add the Value Attribute
The value attribute specifies the value to be added or replaced. Only the add and replace actions require this attribute.
When using the add action, the value attribute behaves differently depending on the target type:
-
Target is an Object – The value attribute merges into the target. If the value has a property with the same name as a value in the target, the target value gets overwritten.
-
Target is an Array – This value attribute is pushed into the array. This value can be any valid JSON element.
-
Target is a String – This value attribute gets concatenated to the end of the target string. This value must be a number or a string.
The following example adds the newOption
configuration option to the addToCartBehavior
list in the user interface.
{
"type": "object",
"modifications": [
{
"target": "$.properties.addToCartBehavior.enum",
"action": "add",
"value": "newOption"
}
]
}