Value too long text varchar (4000)

Hi everyone.
I have a problem.
I’m trying send a value from a textarea.
When I press the “Complete” button in a user task, I get the following error:
“value too long for column text_ varchar (4000)”
I know what it means. I am trying to serialize that string in a listener, but it is executed right after pressing the button. So I have two solutions in mind, but I can’t do anything:

  1. Create or change the “process-engine.mv.db” database with all Text varchar (4000) to Text varchar (5000)
  2. Call the listener just before the Complete button and try to continue the process.

Looking for this error, I have already tried all the solutions in these thread:

Thank you for helping.
Best regards.

For a similar issue, we split up the contents before submission and stored into multiple variables. But it’s sort of a workaround

Well, I think it’s a good idea. But how can I do it just before the submission?

When using embedded forms, in the javascript on submit event, write a logic to split and create/modify your custom variables. Didn’t use ‘cam-variable-name’ since it would create/modify a Camunda variable when submitting and you still will end up with the same issue

First of all, thanks for helping.
I didn’t mention that I use the “default” send button that Camunda provided us. So, I tried calling that function but it didn’t work.
Here is my form structure:

<script type="text/javascript" >
        function split(){
            console.log("hi!");
        }

</script>    
<form name="formularioSolicitante" onsubmit="split()">
...
...
</form>

I too use the default ‘Complete’ button Camunda provides which is shown for embedded forms.

I used something like,

<form role="form">
------------ Your form elements go here ----------------
<script cam-script type="text/form-script">
camForm.on('submit', function(evt)
{
 ------- Your code to access content of textfield, split and assign to variables 
});
</script>
</form>

Access the value of text area userCommentsField using

$scope.variablesForm.userCommentsField.$modelValue

Setting existing variables

camForm.variableManager.variableValue(‘VariableName’, $scope.Variable);

Creating a String variable

camForm.variableManager.createVariable({name: ‘VariableName’,type: ‘String’,value: $scope.Variable ,isDirty: true});

Hi @acaballegn,

if you wrap your String into an Object variable, it will be stored as a blob independent of the length. Have a look here: https://docs.camunda.org/manual/7.11/reference/embedded-forms/java-objects/#creating-a-new-serialized-java-object

Hope this helps, Ingo

1 Like

I have tried both solutions and I find the same error. The object I get is empty. To get the value, I use the following line:
var signScope = $scope.sign
I don’t know if it’s null because this value is self-generated and I don’t write it manually.