JSON reference for the changeRelation action type that adds or removes object relations.
Property description
The changeRelation action type adds or removes a relation of the selected type between each object in the stream and a target object. The target is either the object’s origin object or an object found by name.
If the relation type has a reverse relation type, the action writes or removes the reverse relation as well. The action skips an object that has no origin object, is its own origin, or is the target itself. It also skips a pair of objects whose object types are not allowed for the relation type.
A relationAdded trigger fires once for each side of the relation this action adds, instead of once for a manually added relation. This matters only when another rule is chained to the same relation type.
Automation preview currently fails with “Failed to start preview” for this action type. Test the action by running the automation rule itself instead.
Minimal JSON
{
"key": "",
"type": "changeRelation",
"relationTypeKey": "",
"target": {
"type": "origin"
}
}
{
"key": "",
"type": "changeRelation",
"mode": "add",
"relationTypeKey": "",
"direction": "streamObjectToTarget",
"target": {
"type": "objectLookup",
"objectTypeKey": "",
"name": "Archive"
}
}
Nested properties
| Property | Description | Values | Mandatory |
|---|
key | Key of the action. | string | Yes |
type | changeRelation | string | Yes |
relationTypeKey | Key of the relation type to add or remove. The key must exist, otherwise the package installation fails. | string | Yes |
target | Target object of the relation. | object | Yes |
direction | Direction of the relation. The default value is streamObjectToTarget. See supported direction values. | streamObjectToTarget, targetToStreamObject | No |
mode | Whether the action adds or removes the relation. The default value is add. See supported mode values. | add, remove | No |
Target nested properties
| Property | Description | Values | Mandatory |
|---|
type | Type of target used to find the object. See supported type values. | origin, objectLookup | Yes |
objectTypeKey | Key of the object type of the target object. The key must exist, otherwise the package installation fails. Allowed only for objectLookup. | string | Yes for objectLookup |
name | Name of the target object. The match is not case-sensitive. Allowed only for objectLookup. | string | Yes for objectLookup |
Supported type values
| Value | Description |
|---|
origin | Uses the origin object of each stream object. |
objectLookup | Finds one object by type and name within the space and application of the stream object. If no object or more than one object matches, that stream object is skipped and a warning is logged. |
Supported direction values
| Value | Description |
|---|
streamObjectToTarget | Creates the relation from the stream object to the target. |
targetToStreamObject | Creates the relation from the target to the stream object. |
Supported mode values
| Value | Description |
|---|
add | Adds the relation. A relation that already exists is not added again. |
remove | Removes the relation. A pair without the relation is skipped. |