cancel
Showing results for 
Search instead for 
Did you mean: 

How to add property to a workflow task?

tsongwei3
Champ in-the-making
Champ in-the-making
Hi
I am pretty new to Alfresco, please give me some advice.

I try to add a property of a aspect to my workflow.

The program can do the following:
After I submit the workflow, "my:Aspect" will be added to the selected content. And I am able to see the properties of "my:Aspect" on the document-detail page.

Now I try to add one property selection in the workflow page

I successfully make the selection of "my:myType" displayed on the task page, but the value is not saved to the content after I submit the workflow.
Am I doing something wrong?
—————————————————————————–
   <config evaluator="node-type" condition="mywf:submitGroupReviewTask" replace="true">
      <property-sheet>
         <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
         <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
         <show-property name="bpm:workflowPriority" />
         <show-property name="bpm:workflowDueDate"/>
         <show-property name="my:myType"/>
         <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
         <show-association name="bpm:groupAssignee"/>
      </property-sheet>
   </config>
————————————————————————-
   <aspects>
      <aspect name="my:myAspect">
         <properties>
            <property name="my:myType">
               <type>d:text</type>
               <mandatory>true</mandatory>
               <default>Main Type</default>
               <constraints>
                  <constraint ref="my:typeList" />
               </constraints>
            </property>
            <property name="mySmiley TongueublishDate">
               <type>d:datetime</type>
            </property>   
         </properties>
      </aspect>
   </aspects>

———————————————————————————

Please give me some direction, thanks.
1 REPLY 1

tsongwei3
Champ in-the-making
Champ in-the-making
I somehow get it to work by adding script to the task node.

   <task-node name="addAspect">
      <transition name="transToReview" to="review">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               for (var i = 0; i &lt; bpm_package.children.length; i++) {
                 bpm_package.children[i].properties["my:mytype"] = my_type;
                 bpm_package.children[i].save();
               }
            </script>
         </action>
      </transition>
   </task-node>

Please let me know if there is a better way to do.

thanks