Now that we have a new permission that can be used in workspaces, we will leverage it for our validation logic: we will create a button that will assign a task to people having the "spellingValidation" permission. Only administrators of the workspace can modify the access rights. This means that it is the workspace administrator who decides of the assignments rules, which is more restrictive than the default behavior in Nuxeo DM (the user chooses himself all the participants).
To make this happen, we will leverage the Create Task
operation.
To add the "request" button:
- Right-click on the User actions item of Studio tree, and click New Action Feature.
- Fill in :
- the ID of your new action:
ValidationDemandButton
, - its label:
Request for validation
, - the area where you want the button to be displayed:
Contextual Tools
.
- the ID of your new action:
- Click the button OK.
- In the "Action Enablement" part of the action definition form, enable the button:
- only for documents of type
File
, - and for users who have at least the
Write
permission.
- only for documents of type
- Click on the
create
link at the bottom of the page, to create the corresponding automation chain. - Give it a name, for instance
RequestForValidationChain
. - Compose this automation chain, see below for the detail. Note the
Services > Create task
operation, whose goal is to assign the task, and to record what operation chain will be called when the task will be validated (and the one call if rejected too). - Save your chain.
How to have the UI options in the automation chains panel.
First you have to define a user action, then, go to the bottom of the option page to the section « action execution » and click on the link Create. You will be redirected to the automation chains panel, but you will have the UI options available.
The **RequestForValidationChain**
chain parameters
N° |
Operation |
Parameter 1 |
parameter 2 |
parameter 3 |
parameter 4 |
parameter 5 |
parameter 6 |
parameter 7 |
---|---|---|---|---|---|---|---|---|
1 |
Fetch > Context Document |
|
|
|
|
|
|
|
2 |
Users Interface > Add Info Message |
message: The workflow has been Started |
|
|
|
|
|
|
3 |
Users and Groups > Get Users and Groups |
permission: validationWorkflow_validation |
variable name: assignees |
|
Prefix Identifier: True |
|
|
|
4 |
Users and Groups > Get Principal Emails |
permission: validationWorkflow_validation |
variable name: groupEmails |
|
|
|
|
|
5 |
Execution Context > Set Context Variable |
name: UserLastName |
value: @{CurrentUser.LastName} |
|
|
|
|
|
6 |
Execution Context > Set Context Variable |
name: UserFirstName |
value: @{CurrentUser.FirstName} |
|
|
|
|
|
7 |
Users and Groups > Login As |
name: Administrator |
|
|
|
|
|
|
8 |
Services > Create task |
Task name: |
Due date: |
Directive: |
Comment: |
accept operation chain: |
reject operation chain: |
variable name for actors prefixed ids: |
9 |
Users and Groups > Logout |
|
|
|
|
|
|
|
10 |
Notification > Send E-Mail |
from: |
message: Click on the icon to select your mail template |
Subject: Document Validation: @{Document.name} |
To: |
As HTML: checked |
|
viewID: |
In this sample, when the user validates, we call the validation chain and everything stops. We could also have decided to run another "Create Task" in that ValidationChain
, so as to create the task for next step validation, and continue all along the life cycle of the document if necessary.
If you want to allow the user to launch a workflow without leaving him the rights to approve or reject the task, you can login as an Administrator using the « Users & Groups > Login As » block just before the « Services > Create task » block. Like that, the task will be created as an administrator and the current used won’t have the basics approve / reject rights on the task. Don’t forget to logout after that.