Move an item to Blocked state

📘

How to apply this rule?

Move a User Story to Blocked state when a new blocker relation is added

The filter by Slave.Project.Process.Name is optional

[
  {
    "type": "source:targetprocess:EntityChanged",
    "entityTypes": [
      "relation"
    ],
    "modifications": {
      "created": true,
      "deleted": false,
      "updated": false
    }
  },
  {
    "type": "filter:Relational",
    "or": [
      {
        "and": [
          {
            "target": {
              "type": "field",
              "name": "Name",
              "target": {
                "type": "field",
                "name": "EntityType",
                "target": {
                  "type": "field",
                  "name": "Slave",
                  "target": {
                    "type": "pipelineBlockOutput"
                  }
                }
              }
            },
            "value": {
              "type": "constant",
              "value": "UserStory"
            },
            "operator": {
              "type": "is"
            }
          },
          {
            "target": {
              "type": "field",
              "name": "Name",
              "target": {
                "type": "field",
                "name": "RelationType",
                "target": {
                  "type": "pipelineBlockOutput"
                }
              }
            },
            "value": {
              "type": "constant",
              "value": "Blocker"
            },
            "operator": {
              "type": "is"
            }
          },
          {
            "target": {
              "type": "field",
              "name": "Name",
              "target": {
                "type": "field",
                "name": "EntityState",
                "target": {
                  "type": "field",
                  "name": "Slave",
                  "target": {
                    "type": "pipelineBlockOutput"
                  }
                }
              }
            },
            "value": {
              "type": "constant",
              "value": "Blocked"
            },
            "operator": {
              "type": "is not"
            }
          },
          {
            "target": {
              "type": "field",
              "name": "Name",
              "target": {
                "type": "field",
                "name": "Process",
                "target": {
                  "type": "field",
                  "name": "Project",
                  "target": {
                    "type": "field",
                    "name": "Slave",
                    "target": {
                      "type": "pipelineBlockOutput"
                    }
                  }
                }
              }
            },
            "value": {
              "type": "constant",
              "value": "Mobile"
            },
            "operator": {
              "type": "is"
            }
          }
        ]
      }
    ]
  },
  {
    "type": "action:JavaScript",
    "script": "return {\n  command: \"targetprocess:MoveToState\",\n  payload: {\n    resourceType: \"UserStory\",\n    resourceId: args.Current.Slave.Id,\n    stateName: \"Blocked\"\n  }\n}"
  }
]