AnsweredAssumed Answered

Freemarker using association for avatar

Question asked by singleton on Jan 4, 2011
Latest reply on Jan 4, 2011 by singleton
Hi,

I was trying the following code to indicate via webscript an user has uploaded his avatar or not:
<#if node.assocs["cm:avatar"]?is_collection && node.assocs["cm:avatar"]?size &gt; 0>"avatar": "y",<#else>"avatar": "n",</#if>

node is of type cm:person, the above association gives an error:
freemarker.core.InvalidReferenceException: Expression node.assocs["cm:avatar"] is undefined on line 25, column 14 in tdc/node.inc.ftl at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)

According the contentmodel the 'avatar' association is correct, how to solve this issue?

Outcomes