Skip to main content

deleteObjectKeys

A Workflow Engine function that allows deletion of keys from an object. The modified object is saved to a specified target, which can be an event field, a workflowContext or payload key.

This function is available as a feature of the Add-ons v2.3 download and later.

This function is available for event, alert, and Situation workflows.

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function deleteObjectKeys takes the following arguments:

Name

Required

Type

Description

object

yes

string

The object the function modifies. To take the value from a field, use substitutions, such as $(custom_info.object).

keys

yes

object

A JSON array of keys to delete.

target

yes

string

The destination in which to store the updated object. To store a worfkflowContext or payload key, use the appropriate prefix, such as workflowContext.new_object.

Example

The following example demonstrates typical use of Workflow Engine function deleteObjectKeys.

The object argument can be hardcoded in the function but is usually be taken from a CEvent field or workflow context key using substitutions.

To take the object from the workflowContext key object, delete the key foo.bar[0] and then write the new object to the original workflowContext key object, define the function with the following arguments:

Argument Name

Argument Value

object

$(workflowContext.object)

keys

[ "foo.bar[0]" ]

target

workflowContext.object

The UI translates your settings to the following JSON:

{"object":"$(workflowContext.object)","keys": ["foo.bar[0]"] ,"target":"workflowContext.object"}

If the original object key held this value:

{
    "foo": {
      "bar": [
        {
          "foo .[] bar": "moo",
          "zoo": [
            0
          ]
        },
        "k"
      ]
    }
}

The final value of the workflow context key object is:

{
  "foo": {
    "bar": [
        "k"
    ]
  }
}    

In the original object, the first element is removed from the array held in workflowContext.object.foo.bar.