AnsweredAssumed Answered

Potential Share Association Issue

Question asked by eamell on Jul 8, 2013
Latest reply on Jul 10, 2013 by eamell
I have a client on Alfresco Enterprise 4.1.2 who wants to be able to click the attachments for a custom type to be able to navigate to the attachments.  A quick look at the Forms wiki and this seems pretty straight forward.  I added the following to my Share custom config:


<field id="cm:attachments">
   <control template="/org/alfresco/components/form/controls/association.ftl">
      <control-param name="displayMode">list</control-param>
      <control-param name="showTargetLink">true</control-param>
   </control>
</field>


I test it first on an email and it works beautifully.  I then click the link for one of the attachments and I get the following error on the details screen for the attachment (I have trimmed it for readability):

<blockquote>
2013-07-08 13:52:00,181  ERROR [freemarker.runtime] [http-8080-1] Template processing error: "Expression field.endpointType is undefined on line 22, column 20 in org/alfresco/components/form/controls/association.ftl."

Expression field.endpointType is undefined on line 22, column 20 in org/alfresco/components/form/controls/association.ftl.
The problematic instruction:
———-
==> ${field.endpointType} [on line 22, column 18 in org/alfresco/components/form/controls/association.ftl]
in include "${field.control.template}" [on line 90, column 7 in org/alfresco/components/form/form.lib.ftl]
in user-directive renderField [on line 121, column 13 in org/alfresco/components/form/form.lib.ftl]
in user-directive formLib.renderSet [on line 23, column 16 in org/alfresco/components/form/form.get.html.ftl]
in user-directive formLib.renderFormContainer [on line 20, column 7 in org/alfresco/components/form/form.get.html.ftl]
———-

Java backtrace for programmers:
———-
freemarker.core.InvalidReferenceException: Expression field.endpointType is undefined on line 22, column 20 in org/alfresco/components/form/controls/association.ftl.
</blockquote>

At this point I figured I could work around it.  I created my own association.ftl (we will call it myAssociation.ftl) where I made one change to line 22 as follows:

<javascript>
      itemType: "${field.endpointType!"cm:cmobject"}",
</javascript>

I added the !"cm:object" part.  This sort of worked.  Now the page comes up but I get a property for cm:attachments (not Attachments) on the attached file.  This is better than it failing but it should just be ignoring it all together.

Is this a bug or am I doing something wrong?

Outcomes