How to change project's variables values with Custom Javascript?

Hi there,

I have a Custom Javascript code into my component’s workflow, and I want to change a component’s variable (but let’s extend the question to any variable) value into this code. But when I click the variable to have its reference and set it to a new value, like :
context.component?.variables?.['36fad30d-9163-4321-a83b-28a8a3be3bf1'] = 10;

… then I have an error in the console :

name: "SyntaxError"
stack: "SyntaxError: Invalid left-hand side in assignment at executeCode ...
message: "Invalid left-hand side in assignment"

… which let me guess I might not be allowed to do this. I could return an object and set another action ‘Change variable value’ thanks to that object but it’s less concise.

Thanks to let me know the good ways.

:wave:

Ah ok, it’s due to optional chaining… thanks !