As per our business requirement, We need to showcase a same set of information (form fields) on various tasks in different process definition. This fields might have default value which is different for each of the process definition.
In order to achieve this, we are trying to create our own custom task. This custom task will have a custom form (not the default form association) as a Property of that custom task. We are able to achive this while creating a process definition. But when we try to deploy the same, it is not working. Also we are not able to take it further.
To be specific,
In Flowable-modeler project, there is a component called a UserTask. We can drag & drop UserTask in flowable-modeler project.
We have created a Custom Task called “EquipmentTask” same as UserTask but with my custom properties. Those custom properties data I need to display while executing the actual process instead of default form.
I am looking for following things.
Is my approach is proper? If not, please suggest one.
What could be the issue for deployment? Is there anything which I am missing?
Let me know if you need more details.
Following are the technical Stack :
Flowable Version - 6.0.0
Java Version - 1.8
MySQL Version - 5.7
That is a fine approach. So you changed the stencilset.json file right?
If you change the flowable-json-converter and add an extension element to the user task to identify it is a “special” user task you could use that information in the Flowable task application (if you are using that app). Otherwise you could use that information in your own app implementation.
Yes, we have changed the code in stencilset.json and other required files to achieve our required UI. You can see the attached screen shot (custom_properties_with_task.png) that we have implemented in our custom task.
Now, we need to showcase those custom properties data (e.g. Instruction Text etc…) while executing the actual process (Task).
So for that we are currently changing TaskInfo.java, Task.java, TaskEntity.java and TaskEntityImpl.java.
For saving the data into database, we have changed Task.xml (Added new column). Also we are changing SaveTaskCmd.java, DefaultFlowable5CompatibilityHandler.java (Method - convertToActiviti5TaskEntity) & other files.
I am looking for following thing :
Is my approach is proper? If not, please suggest one.
Let me know if you need more details.
Following are the technical Stack :
Flowable Version - 6.0.0
Java Version - 1.8
MySQL Version - 5.7
No that’s not the approach we would advise.
You can create extension elements on an Activity instance and elements will be exported as part of the BPMN XML. Then when you fetch the BpmnModel for the process definition, you can get the extension elements from the Activity instance and use them. No need to store them in the database in new columns.
I need some suggestion from your side that where i need to change in flowable project (For Ex. flowable-modeler, flowable-task, etc…) to create the Extension Element (Custom Task) which displays in UI OR should i add Extension Element from UI (Without changing code of flowable project). If yes, then please suggest the UI where i need to change.
Some example link Or suggestion highly appreciated.
To use the extension element you would need to change the flowable-json-converter project to convert a Modeler property to an extension element in the BpmnModel. You can have a look at the UserTaskJsonConverter, which also sets a number of extension elements.
Then to be able to do something with the extension element in the BPMN XML, you would have to change the flowable-task-ui application where needed.
As you told, In flowable-json-converter project i have taken the reference of UserTaskJsonConverter (activiti-idm-assignee Property) and i am able to convert my Modeler property (custom property) to an extension element of UserTask in the BpmnModel. The value of that ExtensionElement is saved in model_editor_json field of act_de_model table. In flowable-ui-task application the value of assignee comes from the database and it displays in task-detail.html. So, i just stucked in how can i get my created UserTask Extension Element and display it in UI OR where i need to change in flowable-ui-task application?
This depends a lot on what you want to do with the value in the user task extension element. Can you provide more details? In general, you need to write some Java logic to retrieve the user task extension element value using repositoryService.getBpmnModel to retrieve the BpmnModel, then BpmnModel.getFlowElement to retrieve the user task by its id, then there’s the getExtensionElements element on the retrieved FlowElement instance, to get all of its extension elements.
can you guide me how you added custom property in flowable modeler, i have just added below code in stencilset_bpmn.json but dont know what to do next who to add custom properties and how to modify custom behavior or logic