AnsweredAssumed Answered

Display metada from document in a workflow task form

Question asked by pweigner on Oct 26, 2007
Latest reply on Oct 28, 2007 by rob562435
I'd like to display metadata assigned to document in workflow task.
I prepared
1. Metadata model for document
2. Metadata model for workflow
3. I designed workflow
4. I configured displaying properties for tasks (webclient/config/costum.xml)
everything was tested and run properly.

I decided to load properties from metadata of a document assigned to workflow.
I created a JavaScript code on transition from task one to task two.

<transition name="send" to="fillData">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                <expression>                                 
                   wfclbMHMPRegimen_wfProjectName = bpm_package.children[0].properties["clbMHMPRegimen:ProjectName"];
                   logger.log("wfclbMHMPRegimen_wfProjectName = " + wfclbMHMPRegimen_wfProjectName);                           
               </expression>
               <variable name="wfclbMHMPRegimen_wfProjectName" access="read,write" />
               
               </script>       
            </action>            
      </transition>

But I got an exception
the variable bpm_package is not defined
.

I have tested also the next case

<transition name="send" to="fillData">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                                              
                   var wfclbMHMPRegimen_wfProjectName = bpm_package.children[0].properties["clbMHMPRegimen:ProjectName"];
                   logger.log("wfclbMHMPRegimen_wfProjectName = " + wfclbMHMPRegimen_wfProjectName);                                    </script>       
            </action>            
      </transition>
There was the package property assigned but not displayed.

I have decided to combine both. bot without success. But I saw the value "Project Name" in task form.

<transition name="send" to="fillData">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                <expression>                                 
                   wfclbMHMPRegimen_wfProjectName = "Project Name";
                   logger.log("wfclbMHMPRegimen_wfProjectName = " + wfclbMHMPRegimen_wfProjectName);                              
               </expression>
               <variable name="wfclbMHMPRegimen_wfProjectName" access="read,write" />
               
               </script>       
            </action>                 
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                                              
                   wfclbMHMPRegimen_wfProjectName = bpm_package.children[0].properties["clbMHMPRegimen:ProjectName"];
                   logger.log("wfclbMHMPRegimen_wfProjectName = " + wfclbMHMPRegimen_wfProjectName);                                       
               
               </script>       
            </action>             
      </transition>

Thanks for your answer…

Outcomes