Set workflow task property before displaying it in UI
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2009 10:01 AM
Hi,
I have a very simple problem. I added a new property "wf:foo" to existing wf:reviewTask type in workflowModel.xml:
I also added this property to the property-sheet description in web-client-config-properties.xml:
I started a “Review & Approve” workflow and I could see the new Foo property field in “Review” task. If I entered a value and clicked Approve, then I could read the entered value in the task transition JavaScript like this (changed review_processdefinition.xml file):
But the problem is that I wish to set the value of Foo property from JavaScript so the value could be displayed in the UI when Review task is opened. I tried doing it this way:
But it doesn't work, the “Foo” field is empty when I opened Review task. (I redeployed the workflow definition and also stared a new workflow, so the new code was in effect.) I also tried setting the value in “task-create” event inside the task node, but it didn't have any effect either.
So, my question is: is it possible to set the value of a workflow task property from JavaScript before it is displayed in the UI, and how is it done? (I am using Alfresco Labs 3 Stable.)
I have a very simple problem. I added a new property "wf:foo" to existing wf:reviewTask type in workflowModel.xml:
<type name="wf:reviewTask"> <parent>bpm:workflowTask</parent> <properties> <property name="wf:foo"> <type>d:text</type> </property> </properties></type>
I also added this property to the property-sheet description in web-client-config-properties.xml:
<config evaluator="node-type" condition="wf:reviewTask" replace="true"> <property-sheet> <!– Existing properties omitted for example purpose –> <show-property name="wf:foo" display-label="Foo" /> </property-sheet> </config>
I started a “Review & Approve” workflow and I could see the new Foo property field in “Review” task. If I entered a value and clicked Approve, then I could read the entered value in the task transition JavaScript like this (changed review_processdefinition.xml file):
<task-node name="review"> <task name="wf:reviewTask" swimlane="reviewer" /> <transition name="approve" to="approved"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> logger.log("wf_foo=" + wf_foo); </script> </action> </transition> <transition name="reject" to="rejected" /></task-node>
But the problem is that I wish to set the value of Foo property from JavaScript so the value could be displayed in the UI when Review task is opened. I tried doing it this way:
<task-node name="review"> <event type="node-enter"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> wf_foo = “bar”; </script> </action> </event> <task name="wf:reviewTask" swimlane="reviewer" /> <transition name="approve" to="approved" /> <transition name="reject" to="rejected" /></task-node>
But it doesn't work, the “Foo” field is empty when I opened Review task. (I redeployed the workflow definition and also stared a new workflow, so the new code was in effect.) I also tried setting the value in “task-create” event inside the task node, but it didn't have any effect either.
So, my question is: is it possible to set the value of a workflow task property from JavaScript before it is displayed in the UI, and how is it done? (I am using Alfresco Labs 3 Stable.)
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2009 09:30 AM
Hi, I found a solution to this right there :
http://forums.alfresco.com/en/viewtopic.php?f=34&t=17310
http://forums.alfresco.com/en/viewtopic.php?f=34&t=17310
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2009 10:26 AM
Thanks, it worked. I was able to set it this way:
<task-node name="review"> <task name="wf:reviewTask" swimlane="reviewer" /> <event type="task-create"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> taskInstance.setVariable('bpm_assignee', people.getPerson('username').nodeRef); </script> </action> </event></task-node>