FeaturesRoles

Roles

In order to define responsible persons for an activity, you can create GWE Roles using SQL statements.
To create a new role or edit existing ones you must go to the Define Roles view:

Smart Services / Workflow Engine / Define Roles

img

Adding & Editing Roles

To edit a role click on any row of the Roles List panel.
Adding a new role is as easy as clicking on the Add New button and filling out the role details in the form.
The Define Role panel requires a few fields to be filled:

  • Role: The name of the role (e.g. MANAGER, TECHNICIAN, DISPATCHER)

  • Table Name: The name of the database table that contains employee id or user name of the person(s) you need for the role (typically this includes em, afm_users, wf_requests or your custom workflow tables). This value can be either written manually with the help of autocomplete or selected from a list of values if you click the select value button (the three dots).

  • Returned Field Name: The name of the field that holds either an employee id or a user name (e.g. if you filled em as the table name, you can set em_id as the return field name). This value can also be either written manually with the help of autocomplete or selected from a list of values if you click the select value button (the three dots).

  • Query Type: By default set to WHERE Clause but it can also be changed to SQL Query for more control over the query.

  • WHERE Clause or SQL Query: Depending on what you selected as the query type you must either add one or more restriction clauses or the full SQL query that returns the desired field.

WHERE Clause

When set to WHERE Clause what you type in the restriction box will be applied after the SQL where clause in a statement that looks like this:

SELECT [Returned Field Name] FROM [Table Name] WHERE [What you type goes here]

e.g. Assuming you selected table name em and return field name em_id you can select employees AFM and AFMDEMO as the responsible users for this role with the following WHERE Clause:

em_id = 'AFM' OR email = '[email protected]'

SQL Query

If you selected SQL Query, you are responsible for writing the whole select statement such that the result contains the previously set return field.
e.g. Assuming you selected table name wf_requests and return field name requestor you can retrieve the user who created the request with the following query:

SELECT requestor FROM wf_requests WHERE wf_requests.request_id = ${wf_requests.request_id}
ℹ️

Tip: You can use binding expressions in your SQL Query such as ${wf_requests.request_id}.
You have access to all the fields of the request.

Verifying the Roles

To verify that your restriction works you can check what the query returns by clicking on the View Result action in the Roles List panel.
This will open a popup with the list of users found matching the criteria of your restriction.

Successful Verification

img

💡

Caveat: Verifying a role only works for simple roles that do not contain binding expressions.

If you attempt to verify a role that contains such an expression you will be greeted with an error message.

Error Verification

img

Refreshing the Roles

If you edit the restriction of an existing role that has pending actions on one or more workflow requests you have the possibility to refresh the pending actions such that they map to the new list of users.
Any users that are no longer returned by the updated restriction will be removed from the pending activities list.
Previous completed actions of those users will be retained for traceability.

To refresh the a role simply click on the Refresh action of your role in the Roles List panel and click Yes when asked for confirmation.