AnsweredAssumed Answered

WEbScript FileUpload and tags Creation

Question asked by zafarale on May 15, 2014
Latest reply on May 16, 2014 by kaynezhang
Hi I have a simple script which recieves file and pushes it into repo. one of the requirement is request can contain tags t associate with newly uploaded file, while preserving tags case.

folowing is the code i am using to create tags

* @param tags array( with tag names in it)
function getTag(tags){
   var store = "workspace://SpacesStore/";

   for(var t=0; t< tags.length; t++) {
      var tag = taggingService.getTag(store, tags[t]);
       var tagExists = (tag != null);   
      if (!tagExists){
                 //It creates tag with lower case
       tag = taggingService.createTag(store, tags[t]);
                 //For some reason after createTag tag was null in some cases
            var tagNode = search.findNode("workspace://SpacesStore/";
                 //Give it a name originally intended
      tags[t] = tag;
   return tags;

when i try to use returned array of tag nodes elsewhere as;

tags = getTag(tags);
for(var t=0; t<tags.length; t++) {
                    //This line works fine[t].name);
                    //This line again sometimes throws NullPointer even though tags array has all  nodes

upload is a node created but not called save() upon.

With webscript debugger attaching break point at and letting it go every time it stops seems to fix the issue.

Any ideas, it's urgent