AnsweredAssumed Answered

Cannot add custom property to document

Question asked by edazcalf on Dec 2, 2009
Latest reply on Dec 2, 2009 by edazcalf
Hello.
How can I add custom properties to documents in my repository?

I followed the example in the alfresco wiki:
http://wiki.alfresco.com/wiki/3.2_JavaScript_API#Modifying_and_Creating_API
… but when I try to access upload.properties["myCustomProperty0"] from the response template I get an error:
11020015 Error during processing of the template 'Expression upload.properties["myCustomProperty0"] is undefined

This is part of the code in my js file (upload.post.js):
 
//…
// create document in company home for uploaded file
  upload = companyhome.createFile("BAupload" + companyhome.children.length + "_" + filename) ;
  upload.properties.content.write(content);
  upload.properties.content.mimetype = "UTF-8";
  upload.properties.title = title;
  upload.properties.description = description;
  upload.properties["myCustomProperty0"] = "custompropertyValue";
  upload.save();
 
  // setup model for response template
  model.upload = upload;


Thanks!!

Outcomes