I have a web script: and having a variable catSearchPath
var catSearchPath = "PATH:\"/cm:categoryRoot/cm:generalclassifiable/cm:" + categories[j].replace(/\+/g,"_x0020_").replace(/&/g,"_x0026_").replace(/\//g, "/cm:");
However in another place I am using the JS function in the same web script.
function getSpaceXPath(disPath,rootsapce){
var spacePath="PATH:\"";
var disPPath=disPath.split("/")
for (k=1;k<disPPath.length;k++ ){
if (disPPath[k]=="Company Home"){
spacePath+="/app:company_home";
}
else{
var value=disPPath[k];
spacePath+="/cm:"+value.(/ /g,"_x0020_").replace(/&/g,"_x0026_"); }
}
spacePath+="/cm:"+rootsapce+"//*\""
return spacePath;
}
In the first case the script replace the "+" with "_0020_"; in the second case the script is throwing error, It is not replaing the space to "_0020_"ERROR is
Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/org/alfresco/bg/portlet/links/links.get.js': Failed to execute script 'workspace://SpacesStore//Company Home/Data Dictionary/Web Scripts/org/alfresco/bg/portlet/links/links.get.js': The choice of Java constructor replace matching JavaScript argument types (function,string) is ambiguous; candidate constructors are: class java.lang.String replace(java.lang.CharSequence,java.lang.CharSequence) class java.lang.String replace(char,char) (AlfrescoScript#76)
Exception: org.mozilla.javascript.EvaluatorException - The choice of Java constructor replace matching JavaScript argument types (function,string) is ambiguous; candidate constructors are: class java.lang.String replace(java.lang.CharSequence,java.lang.CharSequence) class java.lang.String replace(char,char) (AlfrescoScript#76)
Any help is appriciated. Thanks