# Flowable 6.5 migration - engineServices Property removed from ExecutionEntity

**URL:** <https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693>\
**Category:** Flowable Engine\
**Created:** [March 23, 2020, 6:20pm UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693 "2020-03-23T18:20:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![binishprab](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/binishprab/32/1649_2.png) [@binishprab](https://forum.flowable.org/u/binishprab)\
**Post date:** [March 23, 2020, 6:20pm UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693/1 "2020-03-23T18:20:59Z")

</div>

Hi

We are migrating from activiti 5.15 to flowable 6.5 - and I see a serious issue given org.activiti.engine.impl.persistence.entity.ExecutionEntity#getEngineServices property has been removed. This was a convenience method used in activiti 5, and our legacy process definitions does use it to fetch flowable core services runtime/identity.

public EngineServices getEngineServices() {  
return Context.getProcessEngineConfiguration();  
}

We are running our legacy process on a V5 engine as instructed in migration guide but I doubt this is good enough because I don’t see any reference to getEngineServices() at all in ExecutionEntity class and I am not sure how to get around this.

Please advise - thanks!

---

<div class="post-metadata">

**Author:** ![binishprab](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/binishprab/32/1649_2.png) [@binishprab](https://forum.flowable.org/u/binishprab)\
**Post date:** [March 24, 2020, 2:32am UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693/2 "2020-03-24T02:32:37Z")

</div>

@joram @martin.grofcik  
Basically all these reference in legacy processes are within scripttask -

ex.  
def identityService = execution.engineServices.identityService;

Not sure if DynamicBPMNServices can be used to correct this on fly?

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [March 24, 2020, 7:36am UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693/3 "2020-03-24T07:36:27Z")

</div>

Hey @binishprab,

In the script you have access to the beans of the engine configuration. So if you are using Spring you can access the services by using `identityServiceBean`.

Yes you can use the `DynamicBPMNService#changeScriptTaskScript` to change the script task of a service.

You have some other options though:

- Change the scripts in all your models and then deploy them again. Use the `SetProcessDefinitionVersionCmd` to migrate your process instances to the new version
- Add your own `ScriptTaskParseHandler` and register it as a `preBpmnParseHandler`.

e.g. Your custom parse handler

```auto
public class CustomScriptTaskParseHandler extends AbstractActivityBpmnParseHandler<ScriptTask> {

    @Override
    public Class<? extends BaseElement> getHandledType() {
        return ScriptTask.class;
    }

    @Override
    protected void executeParse(BpmnParse bpmnParse, ScriptTask scriptTask) {

        String script = scriptTask.getScript();
        if (script != null) {
            scriptTask.setScript(script.replaceAll("execution\\.engineServices\\.identityService", "identityServiceBean"));
        }

    }

}

```

With the last option, you will be changing the script before the activity is created, during the conversion of the XML into the Java Model

---

<div class="post-metadata">

**Author:** ![binishprab](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/binishprab/32/1649_2.png) [@binishprab](https://forum.flowable.org/u/binishprab)\
**Post date:** [March 24, 2020, 2:38pm UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693/4 "2020-03-24T14:38:25Z")

</div>

> [@filiphr](#):
>
> identityServiceBean

Thanks @filiphr - this is great help! Last option to parse and change on the fly works great!

---

<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:** [March 24, 2020, 3:55pm UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693/5 "2020-03-24T15:55:04Z")

</div>

Also, have a look at the section in the migration guide wrt to removal of getEngineServices(): [https://flowable.com/open-source/docs/migration/#engineservices-removed](https://flowable.com/open-source/docs/migration/#engineservices-removed)

---

<div class="post-metadata">

**Author:** ![binishprab](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/binishprab/32/1649_2.png) [@binishprab](https://forum.flowable.org/u/binishprab)\
**Post date:** [March 26, 2020, 1:36pm UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693/6 "2020-03-26T13:36:32Z")

</div>

@filiphr - if we have multiple different script values to replace, one option is to use regex but that might get ugly soon, any other alternative to substitute multiple different strings…?

---

<div class="post-metadata">

**Author:** ![binishprab](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/binishprab/32/1649_2.png) [@binishprab](https://forum.flowable.org/u/binishprab)\
**Post date:** [April 3, 2020, 3:06am UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693/7 "2020-04-03T03:06:21Z")

</div>

Hi @filiphr @joram - even regex won’t be good enough here…suppose you have multiple different scripts to replace, only way I can think of is looking for scriptid and doing a replace but that would be very specific, and won’t handle dynamic replacement for all the scripts - any better ideas?

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [April 3, 2020, 6:09am UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693/8 "2020-04-03T06:09:51Z")

</div>

Hey @binishprab,

You can do multiple `replaceAll`.

e.g.

```auto
scriptTask.setScript(
    script.replaceAll("execution\\.engineServices\\.identityService", "identityServiceBean")
                .replaceAll("execution\\.engineService\\.runtimeService", "runtimeServiceBean")
);

```

---

<div class="post-metadata">

**Author:** ![binishprab](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/binishprab/32/1649_2.png) [@binishprab](https://forum.flowable.org/u/binishprab)\
**Post date:** [April 3, 2020, 6:13am UTC](https://forum.flowable.org/t/flowable-6-5-migration-engineservices-property-removed-from-executionentity/5693/9 "2020-04-03T06:13:11Z")

</div>

ok let me try - thanks!
