I would like to write a JavaScript that associates a file with some already existing document in the repository as soon as the file is uploaded. I know I can use the createAssociation function but I have some trouble getting the nodeRef for the documents. So my question is:
How can I get the NodeRef for already uploaded document and the file being uploaded using JavaScript?
I have been through the examples but I couldn't sort out my prob. Here's my scenario:
I have a custom content type of 'customer form' that the admin uploads to a space. The customer's signature files (images) are uploaded to a separate space. Now I want the customer's form to be associated automatically with his signature file as soon as the customer's form are uploaded. I have the types defined and can do all this in the web client but I want to use Javascript to handle this situation.
I was trying to use CreateAssociation() but I need nodeRef or ScriptNode in order to refer to the customer's form and their signature files. How can I get that?
You need to do a search for the customer's signature file and you'd obtain the nodeRef from that. Depends what you've got to search on: name, folder, etc.
e.g. search.luceneSearch("+@cm\\:name:" + customer)