How to map DMN result to BPM process variable

Hi Experts,

I created a simple BPM flow where I created a Rule task to decide the assignee/candidateGroup of the next task. I created the variable decisionResult to hold the result of the rule task but when I try to access this variable in the execution listener attached to the user task next to it, I get the following error :

This error I get in the Postman from where I initiate the process through REST API.

{

"type": "RestException",

"message": "Cannot instantiate process definition event-subprocess-example:32:fb9e0224-c047-11ec-87c3-e02be903a6c0: ENGINE-17006 Cannot set transient variable with name decisionResult to non-transient variable and vice versa."

}

I am attaching the screenshot of my BPM flow and the Java code for execution listener. Please advise.


Hi @harish2610,

You can try the approach used in below example to map decision results to the variables (instead of using execution listener)

Thanks @hassang for recommending the alternative approach.
I saw that example before but I wanted to avoid using feel script hence I used the java way to map the variables. So is it not possible to map the variables defined in the process model to the java code variables ?

I tried the approach suggested by you but still I am getting same error. I removed the execution listener and commented the java code as well.

ENGINE-17006 Cannot set transient variable with name decisionResult to non-transient variable and vice versa."

PFB the link to my project.


Hi @hassang

I was able to resolve the earlier error by renaming the decision result variable to dmnResult from “decisionResult” as I found below tip in the official documents.

" The result variable should not have the name decisionResult since the decision result itself is saved in a variable with this name. Otherwise an exception is thrown while saving the result variable."

But now I am facing another error :

“Caused by: javax.script.ScriptException: failed to parse expression ‘((for r in dmnResult return get value(r, “assignee”))[item != null])[1]’:
Expected (StringIn(”<=", “>=”, “<”, “>”, “!=”, “=”) | “between” | “in” | “and” | “or” | “…”):1:53, found ")[item != "
"

This is the error I faced at the start and due to this I had to go via Java route as I don’t have proper understanding of FEEL script.

I am not sure, what changes I need to make to make it work.

Please advise.

1 Like

Hi @harish2610,

Then I believe your first solution should work now.

@hassang

This worked with Java after renaming the result variable. Thanks a lot for your time and providing guidance.

1 Like