How to cancel a Workflow using an Automation Chain

I have the following Automation Chain:

Fetch -> Context documents

Workflow Context -> Cancel Workflow | id = @{workflowInstanceId}

I want to cancel this workflow, but I've got the following error

chain Name: UA_Approved Exception: OperationException Caught error: Failed to invoke operation Context.CancelWorkflow Caused by: [Error: unresolvable property or identifier: workflowInstanceId] [Near : {… workflowInstanceId ….}]

         ^

[Line: 1, Column: 1] Hierarchy calls

org.nuxeo.ecm.automation.core.operations.FetchContextDocument
    org.nuxeo.ecm.automation.core.operations.document.SetDocumentLifeCycle
        org.nuxeo.ecm.platform.routing.core.api.operation.CancelWorkflowOperation

at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:193)
at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:89)
at org.nuxeo.ecm.automation.jsf.OperationActionBean.runOperation(OperationActionBean.java:88)
at org.nuxeo.ecm.automation.jsf.OperationActionBean.doOperation(OperationActionBean.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:68)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.nuxeo.ecm.platform.ui.web.util.NuxeoExceptionInterceptor.aroundInvoke(NuxeoExceptionInterceptor.java:79)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
at org.nuxeo.ecm.automation.jsf.OperationActionBean_$$_javassist_74.doOperation(OperationActionBean_$$_javassist_74.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)
at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.nuxeo.ecm.platform.ui.web.binding.MetaMethodExpression.invoke(MetaMethodExpression.java:124)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.component.holder.UIValueHolder.broadcast(UIValueHolder.java:83)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.nuxeo.ecm.platform.ui.web.binding.alias.UIAliasHolder.broadcast(UIAliasHolder.java:86)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at org.nuxeo.ecm.platform.ui.web.lifecycle.NuxeoLifeCycleImpl.execute(NuxeoLifeCycleImpl.java:83)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.nuxeo.wss.servlet.BaseWSSFilter.doFilter(BaseWSSFilter.java:137)
at org.nuxeo.wss.servlet.FailSafeWSSFilter.doFilter(FailSafeWSSFilter.java:55)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.nuxeo.ecm.platform.ui.web.multipart.MultipartFilter.doFilter(MultipartFilter.java:70)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.nuxeo.ecm.core.management.jtajca.internal.Log4jWebFilter.doFilter(Log4jWebFilter.java:64)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.nuxeo.ecm.platform.ui.web.rest.FancyURLFilter.doFilter(FancyURLFilter.java:129)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.nuxeo.ecm.platform.wi.filter.WIRequestFilter.doFilter(WIRequestFilter.java:114)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoRequestControllerFilter.doFilter(NuxeoRequestControllerFilter.java:145)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilterInternal(NuxeoAuthenticationFilter.java:614)
at org.nuxeo.ecm.platform.ui.web.auth.service.NuxeoAuthFilterChain.doFilter(NuxeoAuthFilterChain.java:35)
at org.nuxeo.ecm.platform.ui.web.auth.oauth.NuxeoOAuthFilter.doFilter(NuxeoOAuthFilter.java:119)
at org.nuxeo.ecm.platform.ui.web.auth.service.NuxeoAuthFilterChain.doFilter(NuxeoAuthFilterChain.java:33)
at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilter(NuxeoAuthenticationFilter.java:410)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoCorsFilter.doFilter(NuxeoCorsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.nuxeo.ecm.platform.web.common.exceptionhandling.NuxeoExceptionFilter.doFilter(NuxeoExceptionFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.nuxeo.ecm.platform.web.common.encoding.NuxeoEncodingFilter.doFilter(NuxeoEncodingFilter.java:69)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Caused by: org.nuxeo.ecm.automation.OperationException: Failed to invoke operation Context.CancelWorkflow

at org.nuxeo.ecm.automation.core.impl.InvokableMethod.invoke(InvokableMethod.java:161)
at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:122)
at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:108)
at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:125)
at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:108)
at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.doInvoke(CompiledChainImpl.java:125)
at org.nuxeo.ecm.automation.core.impl.CompiledChainImpl.invoke(CompiledChainImpl.java:108)
at org.nuxeo.ecm.automation.core.impl.OperationServiceImpl.run(OperationServiceImpl.java:168)
... 132 more

Caused by: [Error: unresolvable property or identifier: workflowInstanceId] [Near : {… workflowInstanceId ….}]

         ^
0 votes

2 answers

1658 views

ANSWER

11/27/2015



Hi,

I've found one solution, works in a nominal cas but I'm not sure it's optimal:

  • Fetch > Context Document
  • Fetch > Query :
  • Select * from DocumentRoute where docri:participatingDocuments IN ('@ {Document.id}') AND ecm:currentLifeCycleState = 'running'
  • Workflow Context > Cancel Workflow :
  • id = @{Document.id}
3 votes



Hello,

did you get it work ? I'm facing the same problem.

BR,

Rémi

0 votes