AnsweredAssumed Answered

Dinamic select in form template control

Question asked by pablog. on Nov 27, 2013
Latest reply on Nov 27, 2013 by pablog.
Hi, Is it possible to do next?

I have a pool of documents in a folder; When I start a workflow, I need an input of type "select" that shows all the documents name in that folder:

The form in the share-config-custom.xml is:

<config evaluator="string-compare" condition="activiti$miForm">
               <show id="bgwf:myPropertie1" />
               <set id="mySet" apprearance="title" label-id="workflow.set.Info"/>
            <field id="bgwf:startSAPAction" label-id="workflow.field.opSAPAction" set="mySet" >
           <control template="/org/alfresco/components/form/controls/workflow/my-custom-control.ftl" />

And the file my-custom-control.ftl" contains:

<div class="form-field">   
     <label for="${fieldHtmlId}">${field.label?html}:<#if field.mandatory><span class="mandatory-indicator">${msg("form.required.fields.marker")}</span></#if></label>
     <select id="${fieldHtmlId}" name="${}" tabindex="0">
       <#list companyhome.childrenByLuceneSearch["PATH:\"/app:company_home/cm:Folder_test/*\""] as child>
      <option value="${["name"]}">${["name"]}</option>

But when I going to start the workflow, the next exception is through:

2013-11-27 12:59:18,094  ERROR [freemarker.runtime] [http-apr-28080-exec-6] Template processing error: "Expression companyhome is undefined on line 11, column 40 in org/alfresco/components/form/controls/workflow/my-custom-control.ftl."

Expression companyhome is undefined on line 11, column 40 in org/alfresco/components/form/controls/workflow/my-custom-control.ftl.

If companyhome is an root object and I can use this code in a WebScript, why can't use this way in the control template?

Thank you for your help!