Support
Quality
Security
License
Reuse
kandi has reviewed flowable-engine and discovered the below as its top functions. This is intended to give you an instant insight into flowable-engine implemented functionality, and help decide if they suit your requirements.
A compact and highly efficient workflow and Business Process Management (BPM) platform for developers, system admins and business users.
No Code Snippets are available at this moment for flowable-engine.
QUESTION
How to read form fields by formKey from Activiti/Flowable API
Asked 2019-Jan-11 at 07:19Using Flowable 6.4.0 (also applies to Activiti 6.0.0) I am rendering task form in my application by reading task form properties:
for (FormProperty formProperty : formService.getTaskFormData(taskId).getFormProperties()) {
//... render form field
}
I would like to replace this with Forms that can be designed in form designer and are set on task as formKey (also formReference, seems formReference is web app feature to select form to set formKey and deploy form to app). Problem is I do not see any API method to read form properties based on form key.
Reading answers in this question using formKey is correct way since task form properties are "deprecated", but is there API support for reading form fields for given formKey
? Something like formService.getFormData(formKey, taskId).getFormProperties();
?
Documentation (Flowable, Activiti) talks only about reading deployed form resource file my-custom-form.xml
, does that mean I have to parse form file myself? I also checked Flowable Form Documentation and Sources but I do not see how to read form fields.
ANSWER
Answered 2019-Jan-11 at 07:19If you want to use forms designed with the Flowable Form Designer, then there are additional API methods to fetch a start form and task form in Flowable. The getTaskFormModel(String taskId) method in TaskService gives you for example the form definition associated with the Task with that id:
If you look in the implementation of this method you can see that it uses the formKey attribute of the userTask element to lookup the form definition based on key.
To get a start form of a process definition you can use the following code to lookup the formKey attribute of the startEvent element and get the form definition by key from the FormEngine:
When you retrieved the FormInfo class from the getTaskFromModel method you can use the getFormModel method to retrieve the FormModel interface to get an instance of the Form model. Because the FormModel is made pluggable to make it easier to define your own Form model structure, you need to cast the FormModel interface to SimpleFormModel. From there you can use the getFormFields method to get to the form fields of the form definition.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Explore Related Topics
Save this library and start creating your kit