cancel
Showing results for 
Search instead for 
Did you mean: 

Update value on aspect properties not persisted

acorona
Champ in-the-making
Champ in-the-making
I've created a custom aspect and add it to site model.
Then in my JS webscript i try to update the values but they do not persist . Am using them wrong?

here is the code in question

siteNode.node.properties["my:aspectProp1"]="new value";
siteNode.node.properties["my:aspectProp2"]="new value";
siteNode.save();

— no errors on webscript execution

But when i see the site details in alfresco UI,the fields do not show the values I set.
2 REPLIES 2

derneuling
Champ in-the-making
Champ in-the-making
I have a similar problem. In my case I succeed at updating custom prop1, whilst failing to update prop2!?


<property name="my:prop1">
   <type>d:text</type>
   <mandatory>true</mandatory>
</property>

<property name="my:prop2">
   <type>d:text</type>
   <mandatory>true</mandatory>
   <default></default>
</property>


I use js triggered for a folder rule:

function addPropsToDoc() {
    document.addAspect("{my.model}asp1");
    document.addAspect("{my.model}asp2");
    document.properties["mySmiley Tonguerop2"] = "some value";
    document.properties["mySmiley Tonguerop1"] = "some value";
    document.save();
}

I even tried to split adding the aspect and the property in 2 different js, because I was suspecting the default value to override the property value, but without success.

Did you manage to solve your problem?

derneuling
Champ in-the-making
Champ in-the-making
I solved my problem by removing the
<default>
value from the aspect. Seems that the default is unchangeable via js. I am intrigued to say this is a bug. But you can always remove the default segment from the aspect without trashing your existing data.

After that change, the document.poperties works just fine