When are assignment rules evaluated?

Certified Senior Developer

Does anyone know when assignment rules are evaluated?

We have an expression rule that returns a Group based on a set of parameters. This expression rule can be used for swimlane assignments, attended task assignments and for process model alerts. In order to make most efficient use of this expression rule (and understand the trade-offs between various options) we are keen to know when/if the rule would be evaluated for each of these scenarios.

E.g.

  • If the expression is used in a swimlane assignment will it be evaluated every time a new instance of that process model is initiated or only if an attended task in that swimlane is assigned based on that swimlane assignment (and if so would it be evaluated twice if there were two attended tasks in that swimlane)?
  • If the expression is used directly in the assignment of an attended task will it only be evaluated if that attended task is triggered or is it always evaluated when an instance of that process model is initiated?
  • If the expression is used in the process model alerts tab will it be evaluated every time a new instance of that process model is initiated or only if an alert is raised for that instance?

  Discussion posts and replies are publicly visible

  • I think the assignment expression is evaluated once for a task when it becomes active in a process. Afterwards value is fixed and saved in the process history.

    Other options would be very strange as process can take days, and the expression result can depend on the external context. For example, the expression rule can take someone from a particular group, but the group member can be added or removed from the group.
  • These are some good questions. The documentation does not contain a whole lot about your specific questions. Like sergeiz has mentioned, if you use regular task assignment in your User Input Task node, it will get reevaluated every time that node is started. In other cases (swimlane assignment or throwing an alert) I believe it would reevaluate every time as well instead of initially when starting the process.

    Best way would be to try it out, start the process, change the recipients in the expression rule and then loop around to that same User Input Task node again.
  • 0
    Certified Associate Developer

    Rules that are called within the assignment tab of the swim lane are only evaluated when attended nodes within that lane are reached. Likewise alert expressions are only evaluated when alerts are generated.

  • Agree with the others that the assignment expression is evaluated at task start time, regardless of if it is in the node assignment tab or in the swim lane assignment.  So with either configuration, if the group is updated and the task restarts later, it will utilize the new assignee set.

    I assume the same for the process model alerts recipients, although we have never tested - all our alerts come to system admins only.

    You could test this out by creating a simple model with a script task with a bad expression such as "=if(true,false)" (incorrect number of parameters).  Start the process for debugging, not the recipients, update the group, manually start the bad node again in the active/test process to see if the recipients changed.