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.

Warning

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

PropertyDescriptionValuesMandatory
keyKey of the action.stringYes
typechangeRelationstringYes
relationTypeKeyKey of the relation type to add or remove. The key must exist, otherwise the package installation fails.stringYes
targetTarget object of the relation.objectYes
directionDirection of the relation. The default value is streamObjectToTarget. See supported direction values.streamObjectToTarget, targetToStreamObjectNo
modeWhether the action adds or removes the relation. The default value is add. See supported mode values.add, removeNo

Target nested properties

PropertyDescriptionValuesMandatory
typeType of target used to find the object. See supported type values.origin, objectLookupYes
objectTypeKeyKey of the object type of the target object. The key must exist, otherwise the package installation fails. Allowed only for objectLookup.stringYes for objectLookup
nameName of the target object. The match is not case-sensitive. Allowed only for objectLookup.stringYes for objectLookup

Supported type values

ValueDescription
originUses the origin object of each stream object.
objectLookupFinds 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

ValueDescription
streamObjectToTargetCreates the relation from the stream object to the target.
targetToStreamObjectCreates the relation from the target to the stream object.

Supported mode values

ValueDescription
addAdds the relation. A relation that already exists is not added again.
removeRemoves the relation. A pair without the relation is skipped.