Reopen a Request when replied by requester

๐Ÿ“˜

How to apply this rule?

Move Request to the initial state when replied by requester

912
[
  {
    "type": "source:targetprocess:EntityChanged",
    "entityTypes": [
      "Comment"
    ],
    "modifications": {
      "created": true,
      "deleted": false,
      "updated": false
    }
  },
  {
    "or": [
      {
        "and": [
          {
            "target": {
              "type": "field",
              "name": "Name",
              "target": {
                "type": "field",
                "name": "EntityType",
                "target": {
                  "type": "field",
                  "name": "General",
                  "target": {
                    "type": "pipelineBlockOutput"
                  }
                }
              }
            },
            "value": {
              "type": "constant",
              "value": "Request"
            },
            "operator": {
              "type": "is"
            }
          },
          {
            "target": {
              "type": "field",
              "name": "IsFinal",
              "target": {
                "type": "field",
                "name": "EntityState",
                "target": {
                  "type": "field",
                  "name": "General",
                  "target": {
                    "type": "pipelineBlockOutput"
                  }
                }
              }
            },
            "value": {
              "type": "constant",
              "value": true
            },
            "operator": {
              "type": "is true"
            }
          },
          {
            "target": {
              "type": "field",
              "name": "Kind",
              "target": {
                "type": "field",
                "name": "Owner",
                "target": {
                  "type": "pipelineBlockOutput"
                }
              }
            },
            "value": {
              "type": "constant",
              "value": "Requester"
            },
            "operator": {
              "type": "is"
            }
          }
        ]
      }
    ],
    "type": "filter:Relational"
  },
  {
    "type": "action:targetprocess:MoveToState",
    "target": {
      "name": "General",
      "type": "field",
      "target": {
        "type": "pipelineBlockOutput"
      }
    },
    "stateKind": "Initial"
  }
]

Move Request to a specific state when replied by requester

Filter by Process Name is optional.
Here we're moving requests to a state which is called Replied by Customer

1139
[
  {
    "type": "source:targetprocess:EntityChanged",
    "entityTypes": [
      "Comment"
    ],
    "modifications": {
      "created": true,
      "deleted": false,
      "updated": false
    }
  },
  {
    "or": [
      {
        "and": [
          {
            "value": {
              "type": "constant",
              "value": "Request"
            },
            "target": {
              "name": "Name",
              "type": "field",
              "target": {
                "name": "EntityType",
                "type": "field",
                "target": {
                  "name": "General",
                  "type": "field",
                  "target": {
                    "type": "pipelineBlockOutput"
                  }
                }
              }
            },
            "operator": {
              "type": "is"
            }
          },
          {
            "value": {
              "type": "constant",
              "value": true
            },
            "target": {
              "name": "IsFinal",
              "type": "field",
              "target": {
                "name": "EntityState",
                "type": "field",
                "target": {
                  "name": "General",
                  "type": "field",
                  "target": {
                    "type": "pipelineBlockOutput"
                  }
                }
              }
            },
            "operator": {
              "type": "is true"
            }
          },
          {
            "value": {
              "type": "constant",
              "value": "Requester"
            },
            "target": {
              "name": "Kind",
              "type": "field",
              "target": {
                "name": "Owner",
                "type": "field",
                "target": {
                  "type": "pipelineBlockOutput"
                }
              }
            },
            "operator": {
              "type": "is"
            }
          },
          {
            "value": {
              "type": "constant",
              "value": "Portfolio"
            },
            "target": {
              "name": "Name",
              "type": "field",
              "target": {
                "name": "Process",
                "type": "field",
                "target": {
                  "name": "Project",
                  "type": "field",
                  "target": {
                    "name": "General",
                    "type": "field",
                    "target": {
                      "type": "pipelineBlockOutput"
                    }
                  }
                }
              }
            },
            "operator": {
              "type": "is"
            }
          }
        ]
      }
    ],
    "type": "filter:Relational"
  },
  {
    "type": "action:JavaScript",
    "script": "return {\n  command: \"targetprocess:MoveToState\",\n  payload: {\n    resourceType: \"Request\",\n    resourceId: args.Current.General.Id,\n    stateName: \"Replied by Customer\"\n  }\n}"
  }
]