cancel
Showing results for 
Search instead for 
Did you mean: 

document properties don't get saved in javascript

ramalama188
Champ in-the-making
Champ in-the-making
Hi,

I have setup a rule to a datalist space in order to execute the following javascript:

var currentOwner = document.getOwner();
[b]document.properties["dlextra:vacationRequester"] = people.getPerson(currentOwner).properties["cm:firstName"];[/b]
document.setInheritsPermissions(false);
document.setPermission("Consumer", currentOwner);
document.setOwner("test");

document.save();


The rule is triggered every time an user creates a new item within that datalist. All is working ok except the line where I try to set the value of the "dlextra:vacationRequester" property.  No error is thrown but the new item is created with that prop empty.

I have used the Alfresco javascript debugger and confirmed that is being set with the correct value,  but it's not being displayed in the datalist row. In fact, browsing to that node thru the Alfresco explorer webapp, that property is empty.

Any ideas?  Changing the ownership of the node and permission is working ok.

Thanks
2 REPLIES 2

kevinr
Star Contributor
Star Contributor

var currentOwner = document.getOwner();
document.properties["dlextra:vacationRequester"] = people.getPerson(currentOwner).properties["cm:firstName"];
document.save();
document.setInheritsPermissions(false);
document.setPermission("Consumer", currentOwner);
document.setOwner("test");

Only the properties modifications need a save() - and it should be done before other node modifications. Does that work for you…?

Kev

ramalama188
Champ in-the-making
Champ in-the-making
That worked! 

thank you very much kevinr, much appreciated