02-19-2009 06:59 PM
05-27-2009 08:47 AM
05-27-2009 09:09 AM
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$alwf:my_workflow";
workflow.execute(document);
05-28-2009 09:46 AM
05-28-2009 11:31 AM
Thanks, but than, how can I use "document" in the workflow ?
for example I would like to check the status of the file document.properties["af:status"], but he says "document is not define".
<node name="hello">
<transition name="" to="end1">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<expression>
logger.log(document.name);
</expression>
</script>
</action>
</transition>
</node>
05-29-2009 04:08 AM
05-29-2009 04:09 AM
var workflow = actions.create("start-workflow");
workflow.parameters["bpm:docName"] = document.name;
workflow.parameters.workflowName = "jbpm$alwf:my_workflow";
workflow.execute(document);
<node name="hello">
<transition name="" to="end1">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<expression>
logger.log(bpm.docName);
</expression>
</script>
</action>
</transition>
</node>
05-29-2009 04:11 AM
It seems that we have to use something like "bpm_package.children[0].name" (children[0] for the first item, if you have more attached files in your workflow, you have to use a "for" loop). But I have the same problem "bpm_package is not defined"…
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<runas>admin</runas>
<script>
<variable name="bpm_package" access="read" />
<variable name="companyhome" access="read" />
<expression>
for (var i=0; i < bpm_package.children.length; i++) {
var dest = companyhome.childByNamePath("documents validés");
bpm_package.children[i].move(dest);
}
</expression>
</script>
</action>
05-29-2009 05:22 AM
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$af:workflowTest";
workflow.execute(document);
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="af:workflowTest">
<start-state name="start">
<transition to="Message"></transition>
</start-state>
<node name="Message">
<transition to="end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<runas>admin</runas>
<variable name="bpm_package" access="read" />
if(bpm_package.children.length != 0){
if(bpm_package.children[0].properties["af:status"] == "Pending"){
logger.log("####### Status : " + bpm_package.children[0].properties["af:status"] + " need validation !");
}else{
logger.log("======= Status : " + bpm_package.children[0].properties["af:status"] + " didn't need validation.");
}
}else{
logger.log("No file attached !");
}
</script>
</action>
</transition>
</node>
<end-state name="end"></end-state>
</process-definition>
11:03:16,000 ERROR [org.jbpm.graph.def.GraphElement] action threw exception: Script expression has not been provided
org.alfresco.service.cmr.workflow.WorkflowException: Script expression has not been provided
at org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript.execute(AlfrescoJavaScript.java:123)
at org.jbpm.graph.def.Action.execute(Action.java:122)
at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:264)
at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:220)
at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:190)
at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:174)
at org.jbpm.graph.def.Transition.take(Transition.java:138)
at org.jbpm.graph.def.Node.leave(Node.java:394)
at org.jbpm.graph.def.Node.leave(Node.java:358)
at org.jbpm.graph.def.Node.execute(Node.java:350)
at org.jbpm.graph.def.Node.enter(Node.java:319)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$69e64b0d.enter(<generated>)
at org.jbpm.graph.def.Transition.take(Transition.java:151)
at org.jbpm.graph.def.Node.leave(Node.java:394)
at org.jbpm.graph.node.StartState.leave(StartState.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$69e64b0d.leave(<generated>)
at org.jbpm.graph.exe.Token.signal(Token.java:195)
at org.jbpm.graph.exe.Token.signal(Token.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:157)
at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$1674f1a1.signal(<generated>)
at org.alfresco.repo.workflow.jbpm.JBPMEngine$18.doInJbpm(JBPMEngine.java:976)
at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:338)
at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
at org.alfresco.repo.workflow.jbpm.JBPMEngine.signal(JBPMEngine.java:965)
at org.alfresco.repo.workflow.WorkflowServiceImpl.signal(WorkflowServiceImpl.java:417)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:301)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:229)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy51.signal(Unknown Source)
at org.alfresco.repo.workflow.WorkflowInterpreter.executeCommand(WorkflowInterpreter.java:954)
at org.alfresco.repo.admin.BaseInterpreter$1$1.execute(BaseInterpreter.java:163)
at org.alfresco.repo.admin.BaseInterpreter$1$1.execute(BaseInterpreter.java:161)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:320)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:227)
at org.alfresco.repo.admin.BaseInterpreter$1.doWork(BaseInterpreter.java:166)
at org.alfresco.repo.admin.BaseInterpreter$1.doWork(BaseInterpreter.java:157)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:437)
at org.alfresco.repo.admin.BaseInterpreter.interpretCommand(BaseInterpreter.java:155)
at org.alfresco.web.bean.workflow.WorkflowConsoleBean.interpretCommand(WorkflowConsoleBean.java:196)
at org.alfresco.web.bean.workflow.WorkflowConsoleBean.submitCommand(WorkflowConsoleBean.java:161)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
at javax.faces.component.UICommand.broadcast(UICommand.java:109)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.AdminAuthenticationFilter.doFilter(AdminAuthenticationFilter.java:80)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
05-29-2009 05:37 AM
<node name="Message">
<transition to="end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<runas>admin</runas>
<variable name="bpm_package" access="read" />
<expression>
if(bpm_package.children.length != 0){
if(bpm_package.children[0].properties["af:status"] == "Pending"){
logger.log("####### Status : " + bpm_package.children[0].properties["af:status"] + " need validation !");
}else{
logger.log("======= Status : " + bpm_package.children[0].properties["af:status"] + " didn't need validation.");
}
}else{
logger.log("No file attached !");
}
</expression>
</script>
</action>
</transition>
</node>
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.