01-30-2017 09:47 AM
I am using alfresco webscript to get the list of versions for a document
when i try to get the noderef of a all version using the property
child[i].noderef
as mentioned in below link:-
ScriptNode API | Alfresco Documentation
i get all versions node id as same
Please tell if the noderef is same for all versions
or if there is a way to get unique noderef of each version.
01-31-2017 12:02 PM
The nodeRef is the same because you are getting it from the document (children[i]) instead of the version.
Use docVersions[v].node.nodeRef instead
Update: Sorry - it was late and I got confused by your use of children[i] within the loop. Replaced children[i].node.nodeRef with docVersions[v].node.nodeRef
01-30-2017 03:57 PM
Each node in Alfresco and each version have a unique NodeRef. This is enforced on a DB constraint level and cannot be circumvented. Though there are features that masquerade the underlying NodeRef, e.g. when using multi-tenancy where it is technically possible for two tenants to have nodes with identical NodeRefs. But these identical NodeRefs are only identical on a logical level - in the underyling DB layer they are again unique.
01-31-2017 01:19 AM
Using js webscript how to get the unique noderef for each version of a document ?
01-31-2017 05:22 AM
The documentation on Script API for versions should help you get started...
01-31-2017 08:08 AM
Hi, Anuj
You can get the all versions of a document using this api url,
http://serverort/alfresco/service/api/version?nodeRef=workspace://SpacesStore/09d0c872-3f0a-49df-91f...
You will get the output in JSON format.
01-31-2017 10:10 AM
Axel Faust Vikash Patel
hi,
i am able to get the documents versions .
My question is simply :- At DB level we are having unique noderef for a document version.
but when i do child[i].nodeRef , i get same noderef for all versions
is there some property other than 'noderef' which can give unique node reference.( i am referring to properties like in this documentation -------> ScriptNode API | Alfresco Documentation
Thanks
01-31-2017 10:27 AM
I seriously don't know what you are trying to access "child[i].nodeRef" for - and I don't know what values you have assigned to it. Via the ScriptNode getVersionHistory() operation you get a list of versions, and each version will have a "version.frozenStateNodeRef" property.
01-31-2017 12:02 PM
The nodeRef is the same because you are getting it from the document (children[i]) instead of the version.
Use docVersions[v].node.nodeRef instead
Update: Sorry - it was late and I got confused by your use of children[i] within the loop. Replaced children[i].node.nodeRef with docVersions[v].node.nodeRef
02-01-2017 12:38 AM
on using this ,
i get this error
org.alfresco.error.AlfrescoRuntimeException - 01010316 TypeError: Cannot read property "nodeRef" from undefined
02-01-2017 02:49 AM
this is exactly what i needed !!!!
Thank you
Explore our Alfresco products with the links below. Use labels to filter content by product module.