I have created a workflow in Alfresco, with the following process:
- The workflow initiator fills out a form
- Management is assigned to review the form
- If there are errors, it is kicked back to the initiator to update and revise
- Otherwise, the form is approved and the workflow is complete
My issue is with the review model. It currently looks like the following:
Although it is the next step in the process, the reviewer has no reference to the form information without going back and selecting the "View Workflow" button. On that page a static version of the form is displayed, with all the information.
Is there a way to:
- Display a static copy of the form within the review model?
- Display a static copy of the form before the review model?
Here is an excerpt of the static form in the "View Workflow" area I am referring to, and would like to display:
Many thanks for Krutik for his answer. Below is my full explanation on how I was able to get it to work.
Summary
To get variables to transfer between forms (say between a submit and revise form), you must do the following:
Setting Variables (initial form)
In your .bpmn file, create a task listener on the event where the user first enters data into the form. For example, if you have the form at the start of the workflow, you would use the following:
Or, if you have the first form at a later userTask, change "start" to "create" and place it under that one. Under this listener, you will add a script with different sets:
The if checks to see if you are revisiting this form after an initial submission to revise fields. The first time around, all of your variables will be undefined, so no action will be taken. This allows you to reuse your form without defining yet another model.
identifier_variableName is a name you give the exection variable, and identifier_property is the name for the property you wish to save.
For example, if in your model you have a d:text property in your model called someCo:textBox, you would use:
Resetting Variables (review and revision forms)
As I explained at the start of this answer, creating a duplicate model with the same property names will load in the data from the first form submission. But in order for the revision form to update the data, the variables must be set again.
In your userTask that loads the duplicate form, create a task listener with event="complete". Then, for each variable your defined in the first form, you'll use execution.setVariable like the following:
This updates the execution variable so that when the first form is loaded again, the if statement will be true (as someCo_textBox won't be undefined anymore), and the updated property will display.
If you want to transfer a message between the review and revision forms, simply add a new property to the review and revise models, and add it's respective variable sets.
Code Examples
Unless you completely understood every excerpt of the process I've outlined above, I'm sure you have questions. So, here is a fuller-fledged code example: