Assign Users

👍

You can find more examples at the Automation Rules page

📘

How to apply this rule?

Prerequisites: IDs of Users

This example contains IDs of the default Users as parameters. When you modify User assignments you have to pass the proper numeric ID of a chosen user in your POST calls. IDs can be obtained from the People views or from the system directly.

📘

Get IDs of Users

Use special GET call to API to obtain numeric IDs of Users from your system.

/api/v1/Users?include=[Id,FirstName,LastName,Login,Email,IsActive]&where=LastName contains "Smith"

Prerequisites: IDs of Roles

The code template in this example contains IDs of the Roles as parameters. In your particular template, you have to pass the numeric ID of a chosen role obtained from system settings.

📘

Get IDs of Roles

Use special GET call to API to obtain numeric IDs of Roles from your system.

/api/v1/Roles?include=[Id,Name]&take=1000

Assign a default user(s) to a newly created Request from Support projects

a default user Jane Smith (ID #1) is assigned to a Request with the Role Support Person (ID #13)
a default user John Black (ID #8) is assigned to a Request with the Role Top Manager (ID #8)

1007
[
  {
    "type": "source:targetprocess:EntityChanged",
    "entityTypes": [
      "Request"
    ],
    "modifications": {
      "created": true,
      "deleted": false,
      "updated": false
    }
  },
  {
    "or": [
      {
        "and": [
          {
            "target": {
              "type": "field",
              "name": "Name",
              "target": {
                "type": "field",
                "name": "Project",
                "target": {
                  "type": "pipelineBlockOutput"
                }
              }
            },
            "value": {
              "type": "constant",
              "value": "Support"
            },
            "operator": {
              "type": "is"
            }
          }
        ]
      }
    ],
    "type": "filter:Relational"
  },
  {
    "type": "action:targetprocess:CreateEntity",
    "entityType": {
      "type": "constant",
      "value": "Assignment"
    },
    "fields": {
      "GeneralUser": {
        "type": "constant",
        "value": 1
      },
      "Role": {
        "type": "constant",
        "value": 13
      },
      "Assignable": {
        "type": "field",
        "name": "Id",
        "target": {
          "type": "pipelineBlockOutput"
        }
      }
    }
  },
  {
    "type": "action:targetprocess:CreateEntity",
    "entityType": {
      "type": "constant",
      "value": "Assignment"
    },
    "fields": {
      "GeneralUser": {
        "type": "constant",
        "value": 8
      },
      "Role": {
        "type": "constant",
        "value": 8
      },
      "Assignable": {
        "type": "field",
        "name": "Id",
        "target": {
          "type": "pipelineBlockOutput"
        }
      }
    }
  }
]