Property description
The setUserRelation action type adds, removes, or replaces the users assigned to an object in a role (a user relation type, for example steward or business owner). The action takes the object and the user from each row of the automation stream, or from the user who triggered the automation.
The action skips an object when the change would break a role rule: the role is not allowed for the object type, is read-only for it, allows only one user but the result would have more than one, is mandatory but the result would be empty, or the object is a data product in the Production state that would be left without an owner. An object already at the requested result is also skipped, so a pair of rules assigning users to each other’s roles stops after the first no-op instead of looping.
With userSource set to event, a scheduled run or an event raised by another automation has no triggering user: the action then changes nothing and logs a warning instead of failing the run.
The change raises the same userRelationAdded/userRelationDeleted triggers as a manual edit, so other rules chained to this role can react to it. The writer is the technical user, so a chained rule with its own userSource set to event finds no user and changes nothing.
Automation preview does not apply the role rules above, so an object the real run would skip can still appear as changed in the preview.
Minimal JSON
{
"key": "",
"type": "setUserRelation",
"userRelationTypeKey": ""
}{
"key": "",
"type": "setUserRelation",
"userRelationTypeKey": "core_steward",
"mode": "replace",
"objectSource": "origin",
"userSource": "current"
}Nested properties
| Property | Description | Values | Mandatory |
|---|---|---|---|
key | Key of the action. | string | Yes |
type | setUserRelation | string | Yes |
userRelationTypeKey | Key of the role (user relation type) to change. The key must exist, otherwise the package installation fails. | string | Yes |
mode | Whether the action adds, removes, or replaces users in the role. The default value is add. See supported mode values. | add, remove, replace | No |
objectSource | Which object receives the change. The default value is current. See supported objectSource values. | current, origin | No |
userSource | Where the user comes from. The default value is current. See supported userSource values. | current, event | No |
The mode, objectSource, and userSource values must be written as strings exactly as shown. A number or any other value makes the package installation fail.
Supported mode values
| Value | Description |
|---|---|
add | Adds the user to the role. |
remove | Removes the user from the role. |
replace | Replaces all users in the role with the user. |
Supported objectSource values
| Value | Description |
|---|---|
current | The object of the stream row. |
origin | The origin object of the stream row. |
Supported userSource values
| Value | Description |
|---|---|
current | The user of the stream row, for example a user selected by selectUserObjectRelation. |
event | The user who triggered the automation, for example the user who added the comment. |