> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-platform/6/studio/tasks/reference/set-object-key/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # setObjectKey > Use the setObjectKey task to set a property value on an object by specifying a path, creating the path if it does not exist. The `setObjectKey` task allows you to set a property with a value. You can access the property through its `path`, which is an array. The `path` identifies the property to change or process (modify). This task modifies an object. The basic idea is that a value can be set by passing the object, a path, and the value that will be used to set the property. If the property does not exist (is undefined), a path to it will be created. ## Potential use cases With this task, you can change an item of data in a key value by specifying the path to the key. If a key is non-existent, this task can create the specified key in the object. For example, given a data object like this: ```json let data = { user: { name: "John Doe", age: 34, occupation: "analyst"} }; ``` By using `setObjectKey`, you can set a new key value for `user` such as `experience` (`"senior"`, `"junior"`, `"entry"`), or another demographic value such as `location` (`"USA"`, `"Canada"`, `"Australia"`). Consider another scenario: sometimes you may get a complex object back from an API endpoint with nested levels of data where a query may fail if the expected parameter is absent. You could use `setObjectKey` to set deeply nested properties on an object without needing to check if each key in the path already exists. The task sets the needed value without requiring you to manually verify each key's presence. ## Properties | Input | Type | Description | | ------- | ------ | --------------------------------------------------------------------------------------------------------------------------------- | | `obj` | Object | Required. The object to modify. | | `path` | Array | Required. The path of the property to set. | | `value` | \* | The value to set into `path`. Wildcard values (`*`) represent all values that can be inserted or overwritten into a given `path`. | | Output | Type | Description | | -------- | ------ | ------------------------------------- | | `object` | Object | The modified object that is returned. | ## Example 1 In the example shown below, all the incoming property variables (`obj`, `path`, `value`) are required. The selected reference task (used to define the data source) for each variable is `job`. ![](/_fern-img/8ca0b826c649c3532b2c938067c8dc93fa28abb45e3f7846cc05b44bbd0c659b.webp) The job variables for `setObjectKey` are manually set prior to running the workflow. ![](/_fern-img/41a51cff6417157273e378ab813d1747e881c2018055c96c5a014c233a45891a.webp) After running the workflow, the **Outgoing** tab in **Task History** (accessed from Jobs in Operations Manager) displays the result of executing the task. Notice the object was modified and the `path` now includes `"title": "developer"` as a set property value. ![](/_fern-img/a2f6b86f6c8d70268a2a974159b18181fa373b96d6fb8a62efb7b8c62c9f78ea.webp) ## Example 2 In this example, notice the job variables that were set prior to running the workflow. ![](/_fern-img/c8013b36ab785875b96e6bf5ee5347bdf256a8ef22d41867b7fe6328cd86a1b3.webp) After running the workflow, the modified object is returned with `"Adam":"developer"` as a set property in the given `path`. ![](/_fern-img/afa18ef4ecb9237e5a670fc27fe56174cbf4e50c3e7c922f054ad8590e363f1b.webp) > Use the setObjectKey task to set a property value on an object by specifying a path, creating the path if it does not exist.