Dynamic Forms with Form Key Attribute

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2011 09:56 AM
i want to have dynamic forms for my tasks. I think i'm not really getting the idea of the user so guide. So i tried the following:
in my bpmn process file:
….
<process id="TheFlexibleFrog" name="TheFlexibleFrog">
<documentation>Test a froggy dynamic dropdown menu.</documentation>
<startEvent id="startevent1" name="Start"></startEvent>
<endEvent id="endevent1" name="End"></endEvent>
<userTask id="dynamic_dropdown" name="Dynamic Dropdown" activiti:assignee="kermit" activiti:formKey="main/resources/diagrams/FlexForm.xml"></userTask>
<sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="dynamic_dropdown"></sequenceFlow>
<sequenceFlow id="flow2" name="" sourceRef="dynamic_dropdown" targetRef="endevent1"></sequenceFlow>
</process>
…..
in an extra xml-file which i deloyes on my activi:
<?xml version="1.0" encoding="UTF-8"?>
<extensionElements>
<activiti:formProperty id="no_frogs" name="Anzahl Frösche" type="long" variable="0" required="true" readable="true" writable="true"></activiti:formProperty>
<activiti:formProperty id="zubereitungsart" name="Zubereitungsart" type="enum" required="true" readable="true" writable="true">
<activiti:value id="gebraten" name="gebraten"></activiti:value>
<activiti:value id="gekocht" name="gekocht"></activiti:value>
<activiti:value id="frittiert" name="frittiert"></activiti:value>
</activiti:formProperty>
</extensionElements>
But there are no form properties shown when i execute the process and complete the task.
Hope anyone understands my problem :roll: Thanks.
- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2011 03:32 AM
Can anyone explain me how to use the form key attribute?
Thanks a lot.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2011 03:38 AM
You should include the form properties in the bpmn20.xml file so:
<userTask id="dynamic_dropdown" name="Dynamic Dropdown" activiti:assignee="kermit">
<extensionElements>
<activiti:formProperty id="no_frogs" name="Anzahl Frösche" type="long" variable="0" required="true" readable="true" writable="true"></activiti:formProperty>
<activiti:formProperty id="zubereitungsart" name="Zubereitungsart" type="enum" required="true" readable="true" writable="true">
<activiti:value id="gebraten" name="gebraten"></activiti:value>
<activiti:value id="gekocht" name="gekocht"></activiti:value>
<activiti:value id="frittiert" name="frittiert"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
Best regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2011 03:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2011 04:26 AM
Hi,
You should include the form properties in the bpmn20.xml file so:<userTask id="dynamic_dropdown" name="Dynamic Dropdown" activiti:assignee="kermit">
<extensionElements>
<activiti:formProperty id="no_frogs" name="Anzahl Frösche" type="long" variable="0" required="true" readable="true" writable="true"></activiti:formProperty>
<activiti:formProperty id="zubereitungsart" name="Zubereitungsart" type="enum" required="true" readable="true" writable="true">
<activiti:value id="gebraten" name="gebraten"></activiti:value>
<activiti:value id="gekocht" name="gekocht"></activiti:value>
<activiti:value id="frittiert" name="frittiert"></activiti:value>
</activiti:formProperty>
</extensionElements>
</userTask>
Best regards,
When i try to deploy this as a file i get: The prefix "activiti" for element "activiti:formProperty" is not bound.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2011 04:51 AM
<definitions id="example"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="http://example">
Best regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2011 05:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2011 05:16 AM
I think it's good if you read through some examples first in the userguide and the Activiti source code.
In addition, the Activiti in Action book provides a lot of extra details.
You're missing the process element that is required.
Best regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2011 05:26 AM
Hi,
I think it's good if you read through some examples first in the userguide and the Activiti source code.
In addition, the Activiti in Action book provides a lot of extra details.
You're missing the process element that is required.
Best regards,
This is what the userguide says, there is nothing about what this "my-custom-form.xml" should contain. Thats not quite much, i think.
The attribute <userTask activiti:formKey="…" is exposed by the API through String FormService.getStartFormData(String processDefinitionId).getFormKey() and String FormService.getTaskFormData(String taskId).getFormKey(). You could use this to store the full name of the template within your deployment (eg. org/activiti/example/form/my-custom-form.xml), but this is not required at all. For instance, you could also store a generic key in the form attribute and apply an algorithm or transformation to get to the actual template that needs to be used. This might be handy when you want to render different forms for different UI technologies like e.g. one form for usage in a web app of normal screen size, one form for mobile phone's small screens and maybe even a template for a IM form or an email form.
Thanks for your help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2011 05:33 AM
You can retrieve the form key value and the XML file corresponding to it via the Activiti API, but then you've to develop the UI logic yourself.
Best regards,
