# How to restrict the scope of a signal to a subset of process instances?

**URL:** <https://forum.flowable.org/t/how-to-restrict-the-scope-of-a-signal-to-a-subset-of-process-instances/6429>\
**Category:** Flowable Engine\
**Created:** [July 23, 2020, 8:11pm UTC](https://forum.flowable.org/t/how-to-restrict-the-scope-of-a-signal-to-a-subset-of-process-instances/6429 "2020-07-23T20:11:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mizar](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@Mizar](https://forum.flowable.org/u/Mizar)\
**Post date:** [July 23, 2020, 8:11pm UTC](https://forum.flowable.org/t/how-to-restrict-the-scope-of-a-signal-to-a-subset-of-process-instances/6429/1 "2020-07-23T20:11:01Z")

</div>

Hello!

I’m trying to do the following:  
I’ve created a process model A, that at some point will trigger **twice** the execution of a second process B.

Suppose I trigger 2 instances of process A (A1, A2), thus creating 4 instances of process B (B1, B2 triggerred by A1 / B3, B4 triggered by A2).

My goal is to be able to cancel B1 and B2 via a signal thrown from A1.  
I am able to create a variable myProcessInstanceId = execution.getProcessInstanceId() in process A, and to pass it into the instances of B, so I have a unique way to connect/match A1 with B1 and B2.

I have tried to define the signal as such  
`<signal id="DeleteSignal" name="${myProcessInstanceId}" flowable:scope="global"></signal>`

But such signal cancels all 4 instances of B, instead of just B1 and B2.

I assume I should use the process instance id variable in the signal id instead, eg.:  
`<signal id="${myProcessInstanceId}" name="DeleteSignal" flowable:scope="global"></signal>`  
but this causes app deployment error.

Any idea how I could handle this?

Thanks a lot,  
Antoine

---

<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:** [July 30, 2020, 5:05pm UTC](https://forum.flowable.org/t/how-to-restrict-the-scope-of-a-signal-to-a-subset-of-process-instances/6429/2 "2020-07-30T17:05:08Z")

</div>

You need to use a signal Expression:

`<signalEventDefinition flowable:signalExpression="${throwSignal}"></signalEventDefinition>`

to allow for dynamic signals.

---

<div class="post-metadata">

**Author:** ![Mizar](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@Mizar](https://forum.flowable.org/u/Mizar)\
**Post date:** [July 31, 2020, 9:05am UTC](https://forum.flowable.org/t/how-to-restrict-the-scope-of-a-signal-to-a-subset-of-process-instances/6429/3 "2020-07-31T09:05:11Z")

</div>

All clear, thanks a lot!
