cancel
Showing results for 
Search instead for 
Did you mean: 

Webscript and Custom content model

cristina
Champ in-the-making
Champ in-the-making
I need to change the script,  setting the model of content created by me
(customers is the property that I created in the content model,when )

How can I do this?


  upload = userhome.createFile("upload" + userhome.length + "_" + filename) ;
  upload.properties.content.write(content);
  upload.properties.encoding = "UTF-8";
  upload.properties.title = title;
  upload.properties.description = description;
  upload.properties.customers="Rossi"

thanks
3 REPLIES 3

lista
Star Contributor
Star Contributor
Hi,

don't use

upload = userhome.createFile("upload" + userhome.length + "_" + filename) ;

rather use

var node1 = userhome.createNode("create test1.txt", "cm:content");

This code along with a couple of more examples can be found here.

Cheers!

schambon
Champ in-the-making
Champ in-the-making
Hi,

Lista's right. Then, to set your property, use:
upload.properties["prefix:propertyName"] = "Rossi";

So if you've defined in the "my:" namespace, a "my:content" content model with a "my:customer" property, you should use:

var node1 = userhome.createNode("you_node_name", "my:content");
node1.properties.title="whatever title";
(…)
node1.properties["my:customer"] = "Rossi";

Cheers,
Sylvain.

cristina
Champ in-the-making
Champ in-the-making
That's exactly what I needed to know. 
Thanks and Regards

Cristina  Smiley Very Happy