# How can I skip Tasks with variables as filter criteria

**URL:** <https://forum.flowable.org/t/how-can-i-skip-tasks-with-variables-as-filter-criteria/9762>\
**Category:** Flowable Engine\
**Created:** [September 26, 2022, 10:56am UTC](https://forum.flowable.org/t/how-can-i-skip-tasks-with-variables-as-filter-criteria/9762 "2022-09-26T10:56:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JimMoriarty](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@JimMoriarty](https://forum.flowable.org/u/JimMoriarty)\
**Post date:** [September 26, 2022, 10:56am UTC](https://forum.flowable.org/t/how-can-i-skip-tasks-with-variables-as-filter-criteria/9762/1 "2022-09-26T10:56:02Z")

</div>

I have use case where there are some serviceTasks. Each service task contains some variables like inputParam, outputParam. Now I want to skip serviceTasks for some set of inputParams. For that, I want to store the inputParam as list globally for process and check for serviceTask whether inputParam is in the list or not.

Sample BPMN is like this:

```auto
<?xml version="1.0" encoding="UTF-8"?>

      //some logic to store set of inputParams which can be accessed by all service tasks. Not sure about this logic
      <flowable:field name="inputFilterList">
               <flowable:string>{"inputParam1"}</flowable:string>
      </flowable:field>

      <serviceTask id="INPUT_REFRESH_PARAM1" name="Task execute 1" skipExpression="${//expression to check if testInputParam1 is in inputFilterList//}" flowable:async="true" flowable:triggerable="true" flowable:class="RefreshTaskDelegate">
         <extensionElements>
            <flowable:field name="inputParam">
               <flowable:string>["testInputParam1"]</flowable:string>
            </flowable:field>
            <flowable:field name="outputParam">
               <flowable:string>["testOutputParam1"]</flowable:string>
            </flowable:field>
         </extensionElements>
      </serviceTask>
      <serviceTask id="INPUT_REFRESH_PARAM2" name="Task execute 2" flowable:async="true" flowable:triggerable="true" flowable:class="RefreshTaskDelegate">
         <extensionElements>
            <flowable:field name="inputParam">
               <flowable:string>["testInputParam2"]</flowable:string>
            </flowable:field>
            <flowable:field name="outputParam">
               <flowable:string>["testOutputParam2"]</flowable:string>
            </flowable:field>
         </extensionElements>
      </serviceTask>

```

How can I achieve this functionality?

---

<div class="post-metadata">

**Author:** ![WelschChristopher](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/welschchristopher/32/2822_2.png) [@WelschChristopher](https://forum.flowable.org/u/WelschChristopher)\
**Post date:** [September 26, 2022, 2:17pm UTC](https://forum.flowable.org/t/how-can-i-skip-tasks-with-variables-as-filter-criteria/9762/2 "2022-09-26T14:17:39Z")

</div>

Hallo @JimMoriarty  
you want to check for conditions and decicde if your task should executed or not?  
You can check out this link  
[Conditional sequence flow](https://www.flowable.com/open-source/docs/bpmn/ch07b-BPMN-Constructs#conditional-sequence-flow) and this [Gateways](https://www.flowable.com/open-source/docs/bpmn/ch07b-BPMN-Constructs#gateways)

Greetings

Christopher

---

<div class="post-metadata">

**Author:** ![JimMoriarty](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@JimMoriarty](https://forum.flowable.org/u/JimMoriarty)\
**Post date:** [September 27, 2022, 1:25pm UTC](https://forum.flowable.org/t/how-can-i-skip-tasks-with-variables-as-filter-criteria/9762/3 "2022-09-27T13:25:06Z")

</div>

Thanks @WelschChristopher.  
Can you also tell me how I can set my own variables at process level, so that those can be accessed across all tasks?

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [October 12, 2022, 10:09am UTC](https://forum.flowable.org/t/how-can-i-skip-tasks-with-variables-as-filter-criteria/9762/4 "2022-10-12T10:09:57Z")

</div>

If you use `execution.setVariable(name, value)`, the variables will be process instance scoped by defaul.

---

<div class="post-metadata">

**Author:** ![JimMoriarty](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@JimMoriarty](https://forum.flowable.org/u/JimMoriarty)\
**Post date:** [October 13, 2022, 6:56pm UTC](https://forum.flowable.org/t/how-can-i-skip-tasks-with-variables-as-filter-criteria/9762/5 "2022-10-13T18:56:22Z")

</div>

Thanks @joram  
I set `_FLOWABLE_SKIP_EXPRESSION_ENABLED` to true like this.  
`variableMap.put("_FLOWABLE_SKIP_EXPRESSION_ENABLED", true) startProcessInstanceById(processDefinitionId, businessKey, variableMap)`  
In my BPMN file I have `flowable:skipExpression="${1==1}"` (kept this for testing purpose). Even now, the task is being executed instead of skipping. Did I miss something?

PS: I verified whether it is set before starting the execution or not. It is set.
