Skip to main content

Grouped custom field sets

Grouped custom field set examples

In the group custom field set examples, we assume we have a custom field set with ID _assets and it contains groups of three custom field definitions with IDs asset_type, asset_value, and asset_age. These are used to capture the client assets that are used as guarantees for loans.

Affecting one custom field value in a custom field group

Adding one custom field value in a custom field group

[
{
"op": "ADD",
"path": "/_assets/2/asset_age",
"value": "5"
}
]

Adding two custom field groups to a custom field set

[
{
"op": "ADD",
"path": "/_assets",
"value": [
{
"asset_type": "Land",
"asset_age": "10",
"asset_value": "965000"
},
{
"asset_type": "Car",
"asset_age": "2",
"asset_value": "25000"
}
]
}
]

To add, replace, or remove a single custom field value within a custom field group, the path property must specify the custom field set ID, the index of the group in the array, and the specific custom field definition.

In the example to the right, we are adding a value for the asset_age property for the custom field group with index 2 in the array.

Adding entire custom field groups to a custom field set

To add an entire new custom field group or multiple new groups, the path property must specify just the custom field set ID. The new group will always be added to the end of the array. You cannot specify a specific index in the array to add it to.

In the example to the right, we are adding two new custom field groups to the custom field set.

Replacing or removing one custom field group in a custom field set

Replacing one custom field group in a custom field set

[
{
"op": "REPLACE",
"path": "/_assets/2",
"value": {
"asset_type": "House",
"asset_age": "3",
"asset_value": "100000"
}
}
]

To replace or remove an entire custom field group, the path property must specify the custom field set ID and the index of the group in the array.

In the example to the right, we are replacing the entire custom field group that is at index 2 in the array.

Replacing or removing all custom field groups in a custom field set

Removing all the custom field groups in a custom field set

[
{
"op": "REMOVE",
"path": "/_assets"
}
]

To replace or remove all the custom field groups for a custom field set, the path property only needs the custom field set ID.

In the example to the right we are removing the custom field group at index 2 in the array.