Alfresco 5.1文档根对象

时间:2016-07-19 11:37:58

标签: alfresco alfresco-webscripts

我的workflow.get.js文件

var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$TrainerEmpanelment";
workflow.parameters["bpm:assignee"] = people.getPerson("admin");
workflow.parameters["bpm:workflowDescription"] = "test";
workflow.parameters["bpm:workflowPriority"] = "2";
workflow.parameters["bpm:sendEMailNotifications"] = true;
workflow.parameters["initiator"] = people.getPerson("admin"); 
var today = new Date();
var duedate = today.getDate() + 1; 
workflow.parameters["bpm:workflowDueDate"] = duedate;
workflow.execute(document);

使用webscript时出现错误

  

Web Script / alfresco / s / workflow /已回复状态为500 - 内部错误。

     

500描述:HTTP服务器内部的一个错误,阻止它完成请求。

     

消息:06190087包装异常(带状态模板):06190504无法执行脚本' /triggerworkflow.get.js(在存储库存储工作区:// SpacesStore / Company Home / Data Dictionary / Web Scripts)&# 39;:06190503 ReferenceError:" document"没有定义。 (在存储库商店workspace:// SpacesStore / Company Home / Data Dictionary / Web Scripts)#11)

     

例外:org.mozilla.javascript.EcmaError - ReferenceError:" document"没有定义。 (在存储库存储工作区:// SpacesStore / Company Home / Data Dictionary / Web Scripts)#11)       org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)       org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)       org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3750)       org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1728)       org.mozilla.javascript.gen._triggerworkflow_get_js__in_repository_store_workspace ___ SpacesStore_Company_Home_Data_Dictionary_Web_Scripts__414._c_script_0(/triggerworkflow.get.js(在存储库商店workspace:// SpacesStore / Company Home / Data Dictionary / Web Scripts):11)       org.mozilla.javascript.gen._triggerworkflow_get_js__in_repository_store_workspace ___ SpacesStore_Company_Home_Data_Dictionary_Web_Scripts__414.call(/triggerworkflowflow.get.js(在存储库商店workspace:// SpacesStore / Company Home / Data Dictionary / Web Scripts))       org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)       org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)       org.mozilla.javascript.gen._triggerworkflow_get_js__in_repository_store_workspace ___ SpacesStore_Company_Home_Data_Dictionary_Web_Scripts__414.call(/triggerworkflowflow.get.js(在存储库商店workspace:// SpacesStore / Company Home / Data Dictionary / Web Scripts))       org.mozilla.javascript.gen._triggerworkflow_get_js__in_repository_store_workspace ___ SpacesStore_Company_Home_Data_Dictionary_Web_Scripts__414.exec(/triggerworkflow.get.js(在存储库商店workspace:// SpacesStore / Company Home / Data Dictionary / Web Scripts))   org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:502)       org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:200)       org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)       org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)       org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)       org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1376)       org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)       org.alfresco.repo.web.scripts.RepositoryContainer $ 3.execute(RepositoryContainer.java:512)       org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:457)       org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:580)       org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:649)       org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:421)       org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:301)       org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)       org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)       org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)       javax.servlet.http.HttpServlet.service(HttpServlet.java:727)       org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)       org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)       org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)       org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)       org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)       org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)       org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)       org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)       org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)       org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)       org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)       org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)       org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)       org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)       org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)       org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)       org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)       org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:611)       org.apache.tomcat.util.net.AprEndpoint $ SocketProcessor.doRun(AprEndpoint.java:2466)       org.apache.tomcat.util.net.AprEndpoint $ SocketProcessor.run(AprEndpoint.java:2455)       java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)       java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)       org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)       java.lang.Thread.run(Thread.java:745)

     

异常:org.alfresco.error.AlfrescoRuntimeException - 06190503 ReferenceError:" document"没有定义。 (在存储库存储工作区:// SpacesStore / Company Home / Data Dictionary / Web Scripts)#11)        org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:526)

     

异常:org.alfresco.scripts.ScriptException - 06190504无法执行脚本' /triggerworkflow.get.js(在存储库存储工作区:// SpacesStore / Company Home / Data Dictionary / Web Scripts)&#39 ;:06190503 ReferenceError:" document"没有定义。 (在存储库存储工作区:// SpacesStore / Company Home / Data Dictionary / Web Scripts)#11)           org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:204)

     

异常:org.springframework.extensions.webscripts.WebScriptException - 06190087 Wrapped Exception(带状态模板):06190504无法执行脚本' /triggerworkflow.get.js(在存储库存储工作区:// SpacesStore / Company主页/数据字典/ Web脚本)':06190503 ReferenceError:" document"没有定义。 (在存储库存储工作区:// SpacesStore / Company Home / Data Dictionary / Web Scripts)#11)           org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1138)

服务器:社区v5.1.0(r122274-b3)架构9,016 时间:2016年7月19日下午5:01:29

1 个答案:

答案 0 :(得分:0)

你能否尝试使用此代码

var workflowAction = workflow.getDefinitionByName("activiti$TrainerEmpanelment");
var package= workflow.createPackage();
var workflow = new Array();

workflow["bpm:assignee"] = people.getPerson("admin");
workflow["bpm:workflowDescription"] = "test";
workflow["bpm:workflowPriority"] = "2";
workflow["bpm:sendEMailNotifications"] = true;
workflow["initiator"] = people.getPerson("admin"); 

var today = new Date();
var duedate = today.getDate() + 1; 

workflow["bpm:workflowDueDate"] = duedate;
workflowAction.startWorkflow(package, workflow);