Skip to content Skip to sidebar Skip to footer

How To Pass Workflow Propert In Control-parm To Ftl File In Alfresco?

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

Solution 1:

It's exactly as skuro said and you're not doing this rightly.

Very simple your config is correct but your ftl lacks some logic.

Why will you first check on <#if field.control.params.caseID??> And then not assign it?

It should be:

<#if field.control.params.caseID??>
   <#assign caseID = field.control.params.caseID>
<#else>
   <#assign caseID = 1>
</#if>

There is no need of a context or args or something.

Take a look at the default ones like /org/alfresco/components/form/controls/textarea.ftl

----- UPDATE -----

So how can one access another field in this template. So we've got another field "wf:caseIDNum" and we want to access that one.

You could use the following hacky mechanism to get it

${form.fields["prop_" + caseID?replace(":","_")].value}

in the form.fields all the current form properties are stored.

BTW don't forget to show the "wf:caseIDNum" and the hidden.ftl template or else the property won't be populated in the fields object ;).

Solution 2:

It all depends on how you implement the control template. The aspect, and its related property are a static entity, they don't get "created" on the folder, they get "applied" to it. On a side note, please be aware that aspects are NOT automatically inherited by children nodes of a folder.

That said, you can indeed specify wf:caseID as the caseID input parameter of the template, than within the FTL you can refer to such a property with

field.control.params.caseID

You will need to implement the logic to go and retrieve the provided property and render it on screen properly.

Post a Comment for "How To Pass Workflow Propert In Control-parm To Ftl File In Alfresco?"