Search code examples
alfrescoalfresco-sharealfresco-webscripts

How to override some of ajax based picker logic?


Alfresco Community v5.2 (other versions too) includes some of preconfigured workflows that available on the page /share/page/start-workflow

I'm interested in "Review and Approve (one or more reviewers) - Assign a review task to multiple reviewers".

Actually, to be more precise - in the logic of assigning.

For example, I want to make some customization - Customization of the user task screen

I want to display members in the table, not in the list. For this I need to understand how they appear in the list.

In the file share-config-custom.xml I can find the path to the templates.

For example, for the bpm:workflowDueDate it will be:

...
<field id="bpm:workflowDueDate" set="info" label-id="workflow.field.due">
  <control template="/org/alfresco/components/form/controls/info.ftl" />
</field>
...

But for bpm:assignees the template is not specified:

...
<field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee" />
...

I assume, that there are some back-end beans, that perform most of the logic.

How can I override some of ajax based picker logic?


Solution

  • If a form control is not provided in the share form config, Alfresco Share falls back to some defaults depending on the type of the field.

    bpm:assignee is an association to a person node, so I would expect it to point by default to association.ftl !

    What I suggest is to copy that file into a new one let's say src/main/amp/alfresco/site-webscripts/${project.groupId}/form/controls/custom-association.ftl

    and then in your share-config-custom.xml copy over the form config for the task with one small update :

    ...
    <field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee" >
      <control template="/${project.groupId}/form/controls/custom-association.ftl" />
    </field>
    ...
    

    and then you can safely fiddle with custom-association.ftl because it is almost never a good idea to override alfresco defaults !


    UPDATE : The value of that control is a list of nodeRefs referring to the nodes of the selected users. It is the ObjectFinder Java script object who is managing things behind the scene, calling a special endpoint to fetch all sort of data to be shown, then manipulates the DOM accordingly ! You might want to look at object-finder.js and picker.inc.ftl