How to handle large process variables

Hi all,
I already asked this question in the bpm.io forum and was pointed to this forum :slight_smile:.

We are using bpmn-js-properties-panel with element templates to define a user task. One input-field (binding type camunda:inputParameter ) contains a json-string which is exceeding the maximum of 4000 characters for a process variable. That means, that we run into a database error after starting the process (and when we reach this user task).

So we need to find another solution for this. But for now I am running out of ideas, so I hope someone else had similar issues and was able to solve it :slight_smile:

Things what I tried:

  • Use a map instead of text in the element template cause our json data could be stored also as map. After reading some forum posts, I think its still not possible to define Maps in element templates (See here).
  • Forking the bpm-properties-panel and define a custom element template type. -> I was not able to find a way to manipulate the process variable type on tab Input/Output so I can store a map instead of a text/script
  • Add a customPreBPMNParseListeners in the processEngine, so I can manipulate the userTask after deployment of the process definition. -> I was able to get the process variable within parseUserTask , but I cannot manipulate the provided xml data.

So, is it possible somehow to solve this issue on modeler or process engine site?

Best Regards
Alex

1 Like

Hi,
Try save your variable as JSON type not String then variable will be stored on a CLOB column without 4000 chars length limitation

Hi,
I don’t think this is possible in the modeler right?

Alex

Yes, it is. You can use Spin to achieve this. See my simple example when I use task start listener diagram_4.bpmn (2.5 KB)

Hi,
thnx for the fast response. Its an interesting approach and it works, if you add your JSON in the script code. I have to read the JSON from an input parameter and it looks like that the startEvent is triggered after the task variables are stored in DB. So this approach does not work for me :frowning:

My script code (Full example → diagram_longvar.bpmn (6.8 KB)):

var longEntryData = execution.getVariableLocal(‘longEntry’);
execution.setVariableLocal(‘longEntry’,S(longEntryData ));

Alex

Hi,
Input variable can be also a Script :slight_smile: See my modification of your diagram
diagram_longvar.bpmn (6.6 KB)
Please keep in mind that last script statement is an output for defined variable. Hence you got 2 variables here (with different scope visibility):

  • longEntry1 - set in a first line of the script (as executed before task is created it has a global process scope)
  • longEntry - as a result of Input variables (in fact is a result of second script line execution.getVariableLocal(‘longEntry1’)) - this variable has local (task) scope
    I remove start script from your example
1 Like

I have the problem. Thanks a lot