Search code examples
bonita

Bonita - How to skip tasks execution


I'm developing a bonita process to run in a Bonita Enterprise instance. I need to use a custom actor filter on each task, for selecting possible approvers.

  • Each actor is mapped to a role
  • Each user has at least one membership with a role and a group
  • Some users have at least two memberships with the same role and two different groups

My actor filter, based on configuration, can match users belonging to one or two groups and the role associated with the actor.

Everything is fine until here, but...

I may have no available approvers for the task, so I need to skip it. Everything seems to be fine again, but here comes my issue:

when I try to skip the task, execution fails because there is no input for the task:

2020-03-10 17:52:24.233 +0000 SEVERE: org.bonitasoft.engine.execution.work.InSessionBonitaWork THREAD_ID=89 | HOSTNAME=xxx | TENANT_ID=1 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException : "PROCESS_DEFINITION_ID=8625658402299344846 | PROCESS_NAME=xxx | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=2003 | ROOT_PROCESS_INSTANCE_ID=2003 | FLOW_NODE_DEFINITION_ID=7701602949247176053 | FLOW_NODE_INSTANCE_ID=40011 | FLOW_NODE_NAME=Task Name | Some data were not found [inputAction]"
org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: PROCESS_DEFINITION_ID=8625658402299344846 | PROCESS_NAME=xxx | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=2003 | ROOT_PROCESS_INSTANCE_ID=2003 | FLOW_NODE_DEFINITION_ID=7701602949247176053 | FLOW_NODE_INSTANCE_ID=40011 | FLOW_NODE_NAME=Task Name | Some data were not found [inputAction]
    at org.bonitasoft.engine.expression.DataExpressionExecutorStrategy.evaluate(DataExpressionExecutorStrategy.java:112)
    at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:154)
    at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsOfKind(ExpressionResolverServiceImpl.java:225)
    at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateAllExpressionsWithNoDependencies(ExpressionResolverServiceImpl.java:182)
    at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:115)
    at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)
    at org.bonitasoft.engine.execution.transition.TransitionConditionEvaluator.evaluateCondition(TransitionConditionEvaluator.java:44)
    at org.bonitasoft.engine.execution.transition.ImplicitGatewayTransitionEvaluator.evaluateTransition(ImplicitGatewayTransitionEvaluator.java:73)
    at org.bonitasoft.engine.execution.transition.ImplicitGatewayTransitionEvaluator.evaluatedTransitions(ImplicitGatewayTransitionEvaluator.java:66)
    at org.bonitasoft.engine.execution.transition.ImplicitGatewayTransitionEvaluator.evaluateTransitions(ImplicitGatewayTransitionEvaluator.java:42)
    at org.bonitasoft.engine.execution.TransitionEvaluator.evaluateOutgoingTransitionsForActivity(TransitionEvaluator.java:80)
    at org.bonitasoft.engine.execution.TransitionEvaluator.evaluateOutgoingTransitions(TransitionEvaluator.java:66)
    at org.bonitasoft.engine.execution.TransitionEvaluator.buildTransitionsWrapper(TransitionEvaluator.java:126)
    at org.bonitasoft.engine.execution.ProcessExecutorImpl.executeValidOutgoingTransitionsAndUpdateTokens(ProcessExecutorImpl.java:698)
    at org.bonitasoft.engine.execution.ProcessExecutorImpl.childFinished(ProcessExecutorImpl.java:588)
    at org.bonitasoft.engine.execution.ContainerRegistry.nodeReachedState(ContainerRegistry.java:58)
    at org.bonitasoft.engine.execution.work.NotifyChildFinishedWork.work(NotifyChildFinishedWork.java:69)
    at org.bonitasoft.engine.execution.work.TxBonitaWork.lambda$work$0(TxBonitaWork.java:42)
    at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)
    at org.bonitasoft.engine.execution.work.TxBonitaWork.work(TxBonitaWork.java:42)
    at org.bonitasoft.engine.execution.work.LockProcessInstanceWork.work(LockProcessInstanceWork.java:63)
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
    at org.bonitasoft.engine.execution.work.InSessionBonitaWork.work(InSessionBonitaWork.java:59)
    at org.bonitasoft.engine.work.BonitaThreadPoolExecutor.lambda$submit$1(BonitaThreadPoolExecutor.java:132)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

all tasks have a contract input with a text variable inputAction with values "approved" or "rejected".

I tried to

  • return an empty list of user IDs, but instantiation fails because the actor filter returns no users;
  • return an empty list of user IDs and skip the task with a "Catch error" attached to the task, but the task is not skipped (exception above);
  • throw a UserFilterException, but the task is not skipped (exception above);
  • use default action, but the task is not skipped (exception above).

Is there a way to accomplish this?


Solution

  • The issue was due to the use of local variables ti process approvers actions. Those variables were not created yet at the moment of failure, so It was not possibile to skip the task (bug?). Moving to pool variables solved my issue.