How to customise object finder control in workflow form?
Today I have asked to the folder object as selectable in one of the custom workflow form.
By default, the object finder will allow you to select the file only.
When I looked at the "packageitems.ftl" file, there is no control param is defined to determine the object to be displayed.
From the share workflow config section, I'm calling the packageItems control like below.
Here is the output:
I just controlled multipleSelectMode : false to select only one folder.
Today I have asked to the folder object as selectable in one of the custom workflow form.
By default, the object finder will allow you to select the file only.
When I looked at the "packageitems.ftl" file, there is no control param is defined to determine the object to be displayed.
var picker = Alfresco.util.ComponentManager.get("${controlId}"); picker.setOptions( { showLinkToTarget: true, targetLinkTemplate: ${documentLinkResolver}, <#if form.mode == "create" && form.destination?? && form.destination?length > 0> startLocation: "${form.destination?js_string}", <#elseif field.control.params.startLocation??> startLocation: "${field.control.params.startLocation?js_string}", </#if> itemType: "cm:content", displayMode: "${field.control.params.displayMode!"list"}", ............. }); So, I have customised the picker little bit to select folders. var picker = Alfresco.util.ComponentManager.get("${controlId}"); picker.setOptions( { showLinkToTarget: true, targetLinkTemplate: ${documentLinkResolver}, <#if form.mode == "create" && form.destination?? && form.destination?length > 0> startLocation: "${form.destination?js_string}", <#elseif field.control.params.startLocation??> startLocation: "${field.control.params.startLocation?js_string}", </#if> <#if field.control.params.itemType?? && field.control.params.itemType?length > 0> itemType: "${field.control.params.itemType}", <#else> itemType: "cm:content", </#if> displayMode: "${field.control.params.displayMode!"list"}", listItemActions: [ <#list actions as action> { name: "${action.name}", <#if action.link??> link: ${action.link}, <#elseif action.event> event: "${action.event}", </#if> label: "${action.label}" }<#if action_has_next>,</#if> </#list>], allowRemoveAction: ${allowRemoveAction?string}, allowRemoveAllAction: ${allowRemoveAllAction?string}, allowSelectAction: ${allowAddAction?string}, selectActionLabel: "${field.control.params.selectActionLabel!msg("button.add")}" });
From the share workflow config section, I'm calling the packageItems control like below.
<config evaluator="string-compare" condition="activiti$MyWorkflow"> <forms> <form> <field-visibility> <show id="bpm:workflowDescription" /> <show id="bpm:workflowDueDate" /> <show id="packageItems" /> <show id="bpm:assignee" /> </field-visibility> <appearance> <set id="" appearance="title" label-id="workflow.set.general" /> <set id="items" appearance="title" label-id="workflow.set.items" /> <set id="other" appearance="title" label-id="workflow.set.other" /> <field id="bpm:workflowDescription" label-id="workflow.field.message"> <control template="/org/alfresco/components/form/controls/textfield.ftl"> <control-param name="style">width: 95%</control-param> </control> </field> <field id="bpm:workflowDueDate" label-id="workflow.field.due"/> <field id="packageItems" set="items" mandatory="true" > <control template="/org/alfresco/components/form/controls/workflow/packageitems.ftl"> <control-param name="itemType">cm:folder</control-param> </control> </field> <field id="bpm:assignee" label="Author" set="other" /> </appearance> </form> </forms> </config>
Here is the output:
I just controlled multipleSelectMode : false to select only one folder.
Hope this helps someone !
Hello,
ReplyDeleteGreat Resources for Alfresco users and beginner like me.
Can You show me how to Add a fileupload fonctionnality in packageItems it would be great to have such function.
Regards