How to stop submition of a previously fetched variable in embedded form

I load a JSON serialized variable in my embedded form as described here: https://docs.camunda.org/manual/7.6/reference/embedded-forms/java-objects/#fetching-an-existing-serialized-java-object-variable

I want to use this variable to visualize data on the form, but I do not want it to be submitted when the task form is completed. Is there any way of telling the variableManager to NOT submit it?

I tried:
camForm.on(‘submit’, function() {
camForm.variableManager.variable(‘personSearchResults’).isDirty = false;

But that did not work.

Thanks!

Hi Bernd,

there is a destroyVariable function on the variableManager you can use for that:

    camForm.on('submit', function() {
      camForm.variableManager.destroyVariable('personSearchResults');
    });

Cheers
Sebastian

1 Like

And destroy doesn’t mean that it will be deleted in the process instance on the server - or not?

Destroy makes the variable manager “forget” about the variable. That way it is not send with the form-submit payload. I don’t think you can delete process instance variables with a task form anyway as it just creates or updates them.

2 Likes

Worked. Great - thanks :slight_smile: Maybe should be mentioned in the docs?

Good to hear :slight_smile: I agree that it would make a good example for the Javascript section. I created a ticket for it.

1 Like