How to get process variable in script task?

Posted on

Good day,

Im trying to figure out how to get simple process variable inside script task. Right now i have code like this:

kcontext.setVariable("sessionId", sessionId);

System.out.println(kcontext.getVariable(sessionId) );

but console returns "null" insted of sessionid so i'm struggling where is the problem? I'm using the form to input sessionId manually, then i'm expecting it to act like process variable so i can do some stuff with it.

i never found documentation on how to get process variable directly from code, so here i am, once again.

Responses