Thanks for the answer but the value is not changed, I did the test on the console displaying the value that is in the variable and appears right but if I try to assign a new value as your script does not work, what could be wrong?
when I click on complete task wouldn’t be submitting the form? But in my drawing it loops and returns to the same task but then would it be a new task or not? I will test moving on to the next task in the stream to see if the variable value changes.
Wonderful, now it worked carrying the variable before, thank you very much. Not wanting to explore much how I can display this value in the form in a label, as it is a loop and back to the same form if I put cam-variable-name in an input says that this variable already exists in the form.
camForm.on('form-loaded', function() {
// this callback is executed *before* the variables are loaded from the server.
// if we declare a variable here, its value will be fetched as well
camForm.variableManager.fetchVariable('customVariable');
});
camForm.on('variables-fetched', function() {
// this callback is executed *after* the variables have been fetched from the server
var variableValue = camForm.variableManager.variableValue('customVariable');
$( '#my-container', camForm.formElement).textContent(variableValue);
});
Notice:
You can get the variable’s value either using camForm.variableManager.variable(‘customVariable’).value
or camForm.variableManager.variableValue('customVariable')