# Modify BpmnModel before deploy

**URL:** <https://forum.flowable.org/t/modify-bpmnmodel-before-deploy/4245>\
**Category:** Flowable Engine\
**Created:** [July 25, 2019, 6:17pm UTC](https://forum.flowable.org/t/modify-bpmnmodel-before-deploy/4245 "2019-07-25T18:17:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jfigueiredo](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jfigueiredo](https://forum.flowable.org/u/jfigueiredo)\
**Post date:** [July 25, 2019, 6:17pm UTC](https://forum.flowable.org/t/modify-bpmnmodel-before-deploy/4245/1 "2019-07-25T18:17:04Z")

</div>

Hi,

Where is the best place to modify BpmnModel before deploy process? The main goal is to create some boundary timer events or service tasks programatically. Can i use (pre/post)BpmnParseHandlers?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [July 26, 2019, 6:41am UTC](https://forum.flowable.org/t/modify-bpmnmodel-before-deploy/4245/2 "2019-07-26T06:41:01Z")

</div>

Hi João,

Can you provide a use case for changing model before a deployment.  
BPMNParseHandlers are used for hooking into process model parsing. You do not change model or deployment but the change is done on the parsed deployment in the memory. That’s a good place to add something (e.g. logger,…) into process instance behavior.

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![jfigueiredo](https://avatars.discourse-cdn.com/v4/letter/j/ce7236/32.png) [@jfigueiredo](https://forum.flowable.org/u/jfigueiredo)\
**Post date:** [July 26, 2019, 8:55am UTC](https://forum.flowable.org/t/modify-bpmnmodel-before-deploy/4245/3 "2019-07-26T08:55:04Z")

</div>

Hi Martin,

We would like to do the following (pex):

- Add an execution listener to some user tasks based on some configuration (this configuration could exist in property files or database)

- Create a boundary timer event for some user tasks using some configuration too

I know that all of this can be done in the modeler directly, but we would like to “add some common behaviour” based on some configurations to avoid depende on users to remember this.

Is possible to do this?

Should this be done here or not done at all 🙂 ?

```
final BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
// TODO: change model here before deployment?
final Deployment deployment = service.createDeployment()
    .category("category")
    .name("name")
    .addBpmnModel("name", model)
    .deploy();

```

Regards,  
João.

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [August 6, 2019, 7:11am UTC](https://forum.flowable.org/t/modify-bpmnmodel-before-deploy/4245/4 "2019-08-06T07:11:47Z")

</div>

Hi João,

> [@jfigueiredo](#):
>
> Add an execution listener to some user tasks based on some configuration

Yes, ParseHandler is exactly the place where you can add required functionality.

> [@jfigueiredo](#):
>
> Create a boundary timer event for some user tasks using some configuration too

I would use Parse handlers. May be easier way would be to add a listener which will create a timer.

Regards  
Martin
