cancel
Showing results for 
Search instead for 
Did you mean: 

Updating document metadata using javascript

sanket
Champ on-the-rise
Champ on-the-rise
Hi Guise,
             I have the nodeRef of a document (lying at a fixed location under Company Home). I just want to change the title or description property of that file using javascript.

But I want to update the file from createcomment.js file.
I have also put my custom method in createcomment.js file ->

 updateFileAfterCommentPost : function commentPost(docNodeRef){
                     alert("7->"+docNodeRef);
                     //var title= document.properties.title;

                  },

How can I use alfresco stuff like the following in my createcomment.js file to update any file?
-> search.findNode(destination);
-> node.addAspect("cm:versionable", props);
-> node.properties.content.write(content);
-> document.properties.title = title;
-> document.save();

Thanks and Regards,
Sanket Mehta.
4 REPLIES 4

mikeh
Star Contributor
Star Contributor
You would write a new webscript in the /alfresco context (i.e. the Repository) and then POST the details from Share to it.

Thanks,
Mike

sanket
Champ on-the-rise
Champ on-the-rise
Thanks Mike for the reply.
If I prepare a new webscript that will update my document, how can I call that webscript from here.

onCreateFormSubmitSuccess : function c(i, j) {
                     
                                                        // webscript call from here. I have the nodeRef in this.docNodeRef variable

                     this.widgets.editor.clear();
                     YAHOO.Bubbling.fire("refreshComments", {
                        reason : "created"
                     });
                     this.enableInputs()
                  },

File -> createcomment-min.js


Thanks and Regards,
Sanket Mehta.

mikeh
Star Contributor
Star Contributor
If I prepare a new webscript that will update my document, how can I call that webscript from here.
There are plenty of examples throughout Share - search for "Alfresco.util.Ajax"

Thanks,
Mike

sanket
Champ on-the-rise
Champ on-the-rise
Ok Mike.
I will work on it and post the updates soon.
Thank you so much for the guidance.