Assign documents automatically with an Assignment Rule
An Assignment Rule assigns documents to users when a condition is met. For example, ERPNext can share out new support Issues among the support team. Each assignment creates a ToDo for the user.
Create an Assignment Rule
- Open the Assignment Rule list, and select New.
- In Document Type, select the document, for example Issue.
- In Description, enter the text of the ToDo. You can use document fields, for example
{{ priority }} priority issue {{ subject }} is assigned to you. - Enter the conditions, as described below.
- In Rule, select how ERPNext picks the user, as described below.
- Add the users, or select the field.
- Select Save.
Conditions
Write each condition as a Python expression. You can use any field of the document, the operators ==, >, <, and the words and and or.
| Condition | When ERPNext uses it | Example |
|---|---|---|
| Assign Condition | Assigns the document when the condition is true. | status == "Open" |
| Unassign Condition | Removes the assignment when the condition is true. | status == "On Hold" |
| Close Condition | Closes the assignment when the condition is true. | status == "Closed" |
A longer example: issue_type == "Technical" and priority == "High" and status == "Open".
Rules
| Rule | How ERPNext picks the user |
|---|---|
| Round Robin | Each user in the Users list in turn. |
| Load Balancing | The user in the Users list with the fewest open assignments. |
| Based on Field | The user in a field of the document. Select the field in Field. |
| Weighted Distribution | Users in proportion to the Weight that you give each user. A user with weight 2 gets twice as many documents as a user with weight 1. |
Use more than one rule
You can create many rules for one document type. Give each rule a Priority. ERPNext tries the rule with the highest priority first.
Set a due date on the assignment
In Due Date Based On, select a date field of the document, for example the Resolution By date of an Issue. ERPNext uses it as the due date of the ToDo, and updates the due date when the field changes.
The option appears only after you select the Document Type, and only if the document has a date or date-and-time field.
Assign only on some days
In the Assignment Days table, add the days on which the rule assigns documents, for example Monday to Friday. Leave the table empty to assign on every day.