Danilo Franco
Danilo Franco

Reputation: 77

Filtering item in an Alfresco Workflow package control

I have a custom Advanced Workflow in Alfresco that contains the bpm:packageItem control. But, by default, this control lists every document the user has permission to. I must list in this control only documents that are associated to an aspect in particular. Is it even possible? How can I implement this?

Upvotes: 1

Views: 678

Answers (2)

Andreas Steffan
Andreas Steffan

Reputation: 6159

You'll have to tweak /org/alfresco/components/form/controls/workflow/packageitems.ftl and use that tweaked copy. In the copy, change itemType: "cm:content" to whatever type or aspect you want. Configure the form to use your tweaked copy for the field:

<field id="packageItems" set="items" >
   <control template="/your-packageitems.ftl"/>
</field>

The default template already supports various configuration options such as where to start. You may want to make your aspect another parameter.

Upvotes: 2

Tahir Malik
Tahir Malik

Reputation: 6643

Very simple, after the first task (or after every task) just do a check on the bpm_package. Just put in the JavaScript within a task or ScriptTask and loop through the bpm_package.

Here in the Wiki there is a nice example on JBPM (script should work in activiti). Snippet:

           <script>
               for (var i = 0; i &lt; bpm_package.children.length; i++)
               {
                  if (!bpm_package.children[i].hasAspect("wfl:status"))
                  {
                     bpm_package.children[i].addAspect("wfl:status");
                  }
               }
           </script>

Upvotes: 2

Related Questions