cancel
Showing results for 
Search instead for 
Did you mean: 

How to get selected list values through script in workflow

lsharmaa
Champ in-the-making
Champ in-the-making
Hi All,

Im working with alfresco 3.4 and my requirement is like i need to include a property(comment Type) with dropdown list in workflow-options page where you can view the Description,due date,priority,comment etc.

My contentworkflow-model file is:


<property name="finalkaplan:commentType">
<type>d:text</type>
   <constraints>
         <constraint ref="finalkaplan:commentTypeList" />
   </constraints>
   </property>
<constraint name="finalkaplan:commentTypeList" type="LIST">
         <parameter name="allowedValues">
            <list>
               <value>copyEditError</value>
               <value>subjectError</value>
               <value>GeneralError</value>
               <value>UnknownError</value>
            </list>
         </parameter>
      </constraint>


My web-cilent-config file is :

<config evaluator="node-type" condition="finalkaplan:reviewTask"
      replace="true">
      <property-sheet>
         <show-property name="bpm:workflowDescription"
            display-label="Description" />
         <show-property name="bpm:workflowDueDate"
            display-label="Due Date" />
         <show-property name="bpm:workflowPriority"
            display-label="Priority" />
            <show-property name="finalkaplan:commentType" display-label="CommentType"/>
         <show-property name="bpm:comment" display-label="Comments" />

My script in process definition is:

<script>
  var temp=bpm_package.children[0].properties["finalkaplan:commentTypeList"];
   taskInstance.setVariable("finalkaplan_commentTypeList",temp);
   doc=companyhome.childByNamePath("Kaplan/Admin/comment");
   var outFile=doc.createFile("comment.txt");
   outFile.content=temp;
   outFile.save();
  </script>

The Exception Im getting is cannot call setvariable() Method of null.so anyone can help me like how to get selected list value in workflow???
or
say lik if i use bpm_package.children[0].properties["finalkaplan:commentTypeList"] means its getting only the first value of the drop down and doesn't returns the selected value. So can anyone help, in the above statement how to get selected value??

Its urgent can anyone help me??
Thanks,
sharma.
1 REPLY 1

lsharmaa
Champ in-the-making
Champ in-the-making
Hi All,

Finally i Myself found the way to get selected list value. we can use Decision node to achieve this task.

<decision name="checkCommentType">
      <transition to="copyEditError">
         <condition expression="#{finalkaplan_commentType == 'copyEditError'}" />
      </transition>
      <transition to="subjectError">
         <condition expression="#{finalkaplan_commentType == 'subjectError'}" />
      </transition>
      <transition to="GeneralError">
         <condition expression="#{finalkaplan_commentType == 'GeneralError'}" />
      </transition>
      <transition to="UnknownError">
         <condition expression="#{finalkaplan_commentType == 'UnknownError'}" />
      </transition>
   </decision>
then create separate node for each list value so when ever the list value is selected means decision node takes care of getting selected values.