cancel
Showing results for 
Search instead for 
Did you mean: 

editing document properties

roseta
Champ in-the-making
Champ in-the-making
I would like to write in a property of the document involved in the workflow (with javascript) in a transition of my own advanced workflow. I've tried with the following piece of code, but it does't work! No erro shows in the log and everything goes on well, but the property stil stais in withe:

<transition name="Geology" to="geologyTask">
   <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
      <runas>admin</runas>
         <script>               
            <expression>

               bpm_package.children[0].properties[cv:tutor]="John";
               bpm_package.children[0].properties[cv:department]="Geology";
               bpm_package.children[0].save();
              
            </expression>
         </script>
   </action>
</transition>

I guess  bpm_package.children[0] isn't really the document involved in the workflow, but why everything works??? Could anyone help me with this, please???
1 REPLY 1

sihnu
Champ in-the-making
Champ in-the-making
Don't know if you have already figured out the problem but I wanted to tell you that it helped me to solve my own. I was implementing the same behaviour to my own workflow and I got it working after reading this thread. So here is my code:

<start-state name="start">
   <task name="eamswf:submitTask" swimlane="initiator"/>
   <transition name="" to="task" >
      <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <runas>admin</runas>
         <script>
            <expression>
               bpm_package.children[0].properties["rma:restrictionPublicityClass"] = eamswf_publicityClass;
               bpm_package.children[0].properties["rma:restrictionSecurityPeriodEnd"] = eamswf_securityPeriod;
               bpm_package.children[0].save();
            </expression>
         </script>
      </action>
   </transition>
</start-state>

It seems to be identical to yours. So I think you could safely think that there is nothing wrong in the code you posted. Are you sure about the properties of the document? Any other idea why it would not work?