cancel
Showing results for 
Search instead for 
Did you mean: 

Editing Older Version

rajesh2
Champ in-the-making
Champ in-the-making
Hi,
I am new to Alfresco ,I have a requirement like want to update the custom property of older Versions.
I guess the content will be in versionstore and i am able to retrieve the version, but not able to update the property.
Is it possible to updtate ?if Yes can someone give the webscript code to update.
That will be really helpfull for me.

Regards,
Rajesh
1 REPLY 1

kofwhgh
Champ in-the-making
Champ in-the-making
Hi Rajesh

I used javabacked webscript

Let's see what a code looks like

String nodeUuid = (String) parameters.get("uuid");
String versionLabel = (String) parameters.get("versionLabel");
String nodePath = "workspace/SpacesStore/" + nodeUuid;
NodeRef nodeRef = repository.findNodeRef("node", nodePath.split("/"));
VersionHistory versionHistory = registry.getVersionService().getVersionHistory(nodeRef);
Version version = versionHistory.getVersion(versionLabel);
NodeRef versionNode = version.getVersionedNodeRef();
registry.getNodeService().setProperty(versionNode, "Your custom property Qname", "value");

I don't test the code.
I wish you solve the problem