cancel
Showing results for 
Search instead for 
Did you mean: 

How to refer to a particular node?

sihnu
Champ in-the-making
Champ in-the-making
Hi

I'm writing a script to update a certain property of certain node. The problem is that I don't know how to refer to that particular node. The node is a document in my Records Management site. The code for updating the property:

document.properties["rma:test"] = "testvalue"
document.save()

How can I refter to the document I want to so I could update the value?
2 REPLIES 2

sihnu
Champ in-the-making
Champ in-the-making
Ok, I found a method:

Updating a property of a node

The property may come from an aspect or not.

      
nodeService.setProperty(nodeRef, PROP_QNAME_MY_PROPERTY, value);

And the wiki page tells this:

Some services are required, you can get them this way:

     
 ServiceRegistry serviceRegistry = (ServiceRegistry) beanFactory.getBean(ServiceRegistry.SERVICE_REGISTRY);
       NodeService nodeService = serviceRegistry.getNodeService();
       ContentService contentService = serviceRegistry.getContentService();
       FileFolderService fileFolderService = serviceRegistry.getFileFolderService();

I copied the first two of the services (as I don't need the latter two) and pasted them to my script and this is what I get:

Exception:   org.mozilla.javascript.EvaluatorException - missing ; before statement (workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts/org/alfresco/sample/upload/upload.post.js#1)

No ";" is really missing. It's about something else. Is this supposed to be used in javascript? And if so what's wrong there? Any help would be appreciated.

Thanks in advance

amitabhandari1
Champ in-the-making
Champ in-the-making
    ServiceRegistry serviceRegistry = (ServiceRegistry) beanFactory.getBean(ServiceRegistry.SERVICE_REGISTRY);
           NodeService nodeService = serviceRegistry.getNodeService();
           ContentService contentService = serviceRegistry.getContentService();
           FileFolderService fileFolderService = serviceRegistry.getFileFolderService();

You cant use this code in javascript . This is for java based code.