Skip to content

fufler/dynamic-activiti-transitions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynamic Activiti Transitions

Overview

Custom Alfresco Share workflow from control that provides a way to disable and enable transition buttons dynamically basing on current form fields state.

Let assume we have a workflow like this (demo workflow included):

UT task has two tansitions: to UT1 and to UT2. We want end user to be able to choose one of the transitions only in case all mandatory for this transition fields are filled. We configure Share form like this:

<config evaluator="task-type" condition="sn:utTask">
  <forms>
    <form>
      <field-visibility>
        <show id="sn:prop1"/>
        <show id="sn:prop2"/>
        <show id="sn:propOutcome"/>
      </field-visibility>
      <appearance>
        <set id="info" appearance="" label-id="workflow.set.task.info"/>
        <set id="other" appearance="title" label-id="workflow.set.other"/>
        <set id="items" appearance="title" label-id="workflow.set.items"/>
        <set id="response" appearance="title" label-id="workflow.set.response"/>
        <field id="sn:prop1" label="Property 1" set="other" mandatory="true"/>
        <field id="sn:prop2" label="Property 2" set="other" mandatory="true"/>
        <field id="sn:propOutcome" set="response">
          <control template="/org/alfresco/components/form/controls/workflow/dynamic-activiti-transitions.ftl">
              <control-param name="mandatoryFields.UT1">sn:prop1</control-param>
              <control-param name="mandatoryFields.UT2">sn:prop2</control-param>
          </control>
      </field>
      </appearance>
    </form>
  </forms>
</config>

So we set sn:prop1 to be mandatory for UT1 transition and sn:prop2 to be mandatory for UT2 transition. So here goes our form: Now try to click any button without any field filled: Now if we fill any field we can see corresponding button enabled and disabled dynamically:

Project status

This control was done as a project during Hack-a-thon session at Alfresco Summit 2013 in Barcelon so it's a bit hacky. It's completely non-intrusive addon for Alfresco that does not override any built-in Alfresco file, but because of that it uses some tricks :) So at the moment it's not supposed to be used for production but feel free to send a pull request if you know how to improve it and done in a proper way.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published