Back

Workflow Assignment Service Logic


Workflow Custom Assignment happens in the integration event handler of a Workflow Assignment Service

When custom assignment is enabled for a task, its Assignment key is passed to the assignment service as the value of the WFKEY field. This key can then be used to define the security profile of assignable users by populating the USERS, ROLES or CREDENTIALS tables.

Commonly a switch statement will be used to handle the different values of the key. 

switch(fields.WFKEY.value) {
  case "manager": 
    // Assign the task to anyone with the role of manager
    tables.ROLES.insertRow();
    tables.ROLES.ROLEID.value = ROLE_MANAGER;	
  break;
	
  case "officeManager":
     // Assign the task to anyone with the role of office manager
    tables.ROLES.insertRow();
    tables.ROLES.ROLEID.value = ROLE_OFFICE_MANAGER;
  break;
}

tables.ROLES.updateTable();

You can specify a more complex security profile in the assignment logic by using the _CONDITION fields. 

  • CREDENTIAL_CONDITION
    • AND – the user must match all credentials in the CREDENTIALS table.
    • OR – the user must match any credentials in the CREDENTIALS table
  • ROLE_CONDITION
    • AND – the  user must match all roles in the ROLES table.
    • OR – the user must match any roles in the ROLES table.
  • ROLE_CREDENTIAL_JOIN_CONDITION
    • AND – The user must meet the role requirement and credential requirement.
    • OR – The user must meet either the role requirement or the credential requirement.

When assignment logic is applied, the USERS table is checked first for a matching user ID. If no matching user ID is found then ROLES/CREDENTIALS tables are checked.

Workflow Process Attribute values for the current Workflow Job can be made available to use within the assignment logic by calling:

tables.ATTRIBUTE.fetchTable();

 Database Resources and Database Services can be used to fetch data to use in your assignment logic.