Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Pass Workflow Propert in Control-Parm to FTL File in Alfresco?
    primarykey
    data
    text
    <p>So for my project, we have some javascript code running as a rule within the Alfresco repository. So whenever a new document comes into a certain space, a new folder is dynamically created and that document is moved into that newly created space. Additionally, whenever a new folder is created, a property is updated like so for the document (expect caseID is actually a dynamically generated value based on a sequence in our database):</p> <pre><code>//Add caseID as a property of the folder var props = new Array(1); props["wf:caseIDNum"] = caseID; var newAspect = newNewSpaceName.addAspect("wf:caseID",props); </code></pre> <p>However, now we want to be able to reference that newly created aspect/property during the course of our workflow in our share-workflow-form-config-.xml file so that it can be passed as a parameter to our control template. That is, currently we have:</p> <pre><code>&lt;field id="wf:submitCode" label-id="workflow.field.outcome" set="actions"&gt; &lt;control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl"/&gt; &lt;/field&gt; </code></pre> <p>But what we want is something like the below:</p> <pre><code>&lt;field id="wf:submitCode" label-id="workflow.field.outcome" set="actions"&gt; &lt;control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl"&gt; &lt;control-param name="caseID"&gt;wf:caseIDNum&lt;/control-param&gt; &lt;/control&gt; &lt;/field&gt; </code></pre> <p>So my question is, is that the proper syntax to pass a variable/property from the workflow model to the FTL file via the control param?</p> <p><strong>Edit (10/25/12)</strong> -</p> <p>So based on the help given here, I tried to modify my ftl page like so...</p> <p><strong>custom-activiti-transitions.ftl</strong>:</p> <pre><code>&lt;#assign caseID = ""&gt; &lt;#if field.control.params.caseID??&gt; &lt;#assign caseID = field.control.params.caseID&gt; &lt;#else&gt; &lt;#assign caseID = null&gt; &lt;/#if&gt; &lt;style type="text/css"&gt; .button { border: 1px solid #666; background: #DCDCDC; padding: 5px; color: #333; text-shadow: 1px 1px #fff; -moz-border-radius: 5px; -webkit-border-radius: 5px border-radius: 5px; cursor: pointer; -moz-box-shadow: 1px 1px 2px rgba(0,0,0,0.3); -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.3); box-shadow: 1px 1px 2px rgba(0,0,0,0.3); } a.button:hover { background: #bbb; color: #000; text-shadow: 1px 1px #eee; } a.button:active { position: relative; top: 1px; left: 1px; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: none; } &lt;/style&gt; &lt;a class="button" href="#" onClick="MyWindow=window.open('http://localhost:8080/alfresco/faces/jsp/custom/CodeSelector.jsp?caseID=${caseID}','My Window','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=300'); return false;" style="text-decoration:none" target="_blank"&gt;&lt;span&gt;Add Codes&lt;/span&gt;&lt;/a&gt; </code></pre> <p>And in my <strong>share-workflow-form-config.xml</strong>, I changed any instance of:</p> <pre><code>&lt;field id="wf:submitCode" label-id="workflow.field.outcome" set="actions"&gt; &lt;control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl"&gt; &lt;/control&gt; &lt;/field&gt; </code></pre> <p>to...</p> <pre><code>&lt;field id="wf:submitCode" label-id="workflow.field.outcome" set="actions"&gt; &lt;control template="/org/alfresco/components/form/controls/workflow/custom-activiti-transitions.ftl"&gt; &lt;control-param name="caseID"&gt;wf:caseIDNum&lt;/control-param&gt; &lt;/control&gt; &lt;/field&gt; </code></pre> <p>My problem is that in the <strong>share-workflow-form-config.xml</strong> where I specify the <code>control-param</code>, I can get it to pass in a hard coded value like "30". However, when I try to get the value of the workflow property like <code>wf:caseIDNum</code>, it returns the actual string in the parameter like: </p> <p><code>http://localhost:8080/alfresco/faces/jsp/custom/CodeSelector.jsp?caseID=wfcaseIDNum</code></p> <p>as opposed to the actual value for the property, i.e. "30".</p> <p>Any ideas on what I could be doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload