AnsweredAssumed Answered

Error on my simple new content type

Question asked by andrea.girardi on Sep 22, 2011
Latest reply on Oct 2, 2011 by openpj
Hi all,

I created this new content type:


<aspect name="kc:HealthNewsItem">
   <title>Knowledge Base Article</title>
   <properties>
      <property name="kc:news_id">
         <title>Old News identifier</title>
         <type>d:int</type>
      </property>
      <property name="kc:status_type">
         <title>News status</title>
         <type>d:text</type>
         <constraints>
            <constraint ref="kc:status_constraint"/>
         </constraints>
      </property>   
   </properties>
</aspect>

And, with a JS I'm trying to create a new object on Repository:


var title = args.title;
var body = args.body;
var news_id = args.id;

var article = companyhome..createNode("article", "cm:content");
article.addAspect("kc:HealthNewsItem");
article.properties["kc:news_id"] = news_id;
article.properties["cm:name"] = title;
article.properties["kc:status_type"] = "Archived";
article.content = args.body;
article.save();

model.article = article;

It's working fine because I found the object on repository but, when I cannot access to properties news_id and status_type if I try this:

<html>
   <head>
      <title>Sample ${article.name}</title>
   </head>
   <body>
      <p>Title : ${article.name} = ${article.id} = ${article.news_id}</p>
      <p>Body : ${article.content}</p>
   </body>
</html>

This is the error message I can see on alfresco log: freemarker.core.InvalidReferenceException: Expression article.news_id is undefined on line 6, column 64 in mySample/add.get.html.ftl.

How can I fix that? How can I see the new properties I added on my model with Alfresco?

thanks for your time, I'm really freaking out…..  :shock:
Andrea

Outcomes