AnsweredAssumed Answered

alfresco freezes on script submit of the user sandbox

Question asked by timkapteijns on Jul 15, 2009
Hello,

I am expiriencing problems when using a script to submit a single or all files from a sandbox. alfresco freezes and does not provide any kind of error message.
with the AVM interface i add a file and use content rules to copy the file to my user sandbox. i accomplish this with the following script:
var fileSource = document.name;
var node1 = space.childByNamePath(fileSource);
var args = new Array(1);
args["store"] = avm.stores;
if(args["store"]!=null)
{ var storeRootNode = avm.lookupStoreRoot(args["store"][3].id);
if (storeRootNode != null)
{
var path = storeRootNode.path + "/ROOT/brands/brandxml/";
var node = avm.lookupNode(path);

if (node1!= null)
{  var props= new Array(2);
  props["wca:parentformname"] = "salesmapxml";
  props["wca:originalparentpath"] = "dsm–admin:/www/avm_webapps/ROOT";
  node1.addAspect("wca:forminstancedata", props);
  node1.save();
}
var copy = crossRepoCopy.copy(node1, node, fileSource) ;

}
}

next in the rule i execute a other script, this script fails. i try to submit all the files in the user sandbox (user admin) , i am currently using labs 3.2
var project = webprojects.getWebProject("DSM");
var sandbox =  project.getSandboxes();
sandbox["DSM–admin"].submitAll("test","Test");

how do i submit the sandbox ( or more preffered a single file).
i already tried submitting whit an asset , but this results in a freeze as wel. there are currently no workflows.

edit:
When using the follow code snippet i see the workflow appearing in "My Alfresco" but without any resources:
var fileSource = document.name;
var node1 = space.childByNamePath(fileSource);
var args = new Array(1);
args["store"] = avm.stores;
if(args["store"]!=null)
{ var storeRootNode = avm.lookupStoreRoot(args["store"][3].id);
if (storeRootNode != null)
{
var path = storeRootNode.path + "/ROOT/brands/brandxml/";
var node = avm.lookupNode(path);

if (node1!= null)
{  var props= new Array(2);
  props["wca:parentformname"] = "salesmapxml";
  props["wca:originalparentpath"] = "dsm–admin:/www/avm_webapps/ROOT";
  node1.addAspect("wca:forminstancedata", props);
  node1.save();
}
var copy = crossRepoCopy.copy(node1, node, fileSource) ;
copy.save();
var file = new Array("ROOT/brands/brandxml/" +fileSource);
var sandboxes = webprojects.getWebProject("DSM").getSandboxes();
var sandbox = sandboxes["DSM–admin"];
if (sandbox != null)
{


sandbox.submit(file, "label","Comment");

}
}
}
i tried changing the file to /www/avm_webapps/root/brands/brandxml/ + fileSource but then the code freezes again

if somebody has code to call the webscript, /api/wcm/webprojects/{webprojectref}/sandboxes/{sandboxref}/submitter?webApp={webApp?} from my javascript ( or any other way ) i would be happy to.
the code must be called by a webspace rule ( did not see the webscript option).

after an half hour i got this :
A system error happened during the operation: 06170009 Failed to execute script 'workspace://SpacesStore/0d9cdf31-d85f-4533-bf20-e8cc78c437da': 06170008 Lock Exists: [.avm_lock_table, web_projects, DSM, 851ccca7011f9907677a386ae967583d]  does this say that the web project is locked or just a file?

Outcomes