How to modify process variable (camunda-external-task-client-js)?

I want to modify process variable in external task client
I could get process variables but could not modify.

When I call variables.setTypes() or variables.set() function,
there’s type error which says set (or setTyped) is not a function

I found when task executed, variables are constructed with readonly: true options

and because of that, Variable does not have set* functions

Am I right?

Do you have any idea to modify process variables?
Is the only way call rest API directly?

test code (typescript)

const output: CamSDK.TypedValue = task.variables.getTyped(‘output’);
try {
output.value[0].videoOptions = ‘modified options…’;
task.variables.set(‘output’, output);
} catch (err) {

console output

[ { file: ‘abc.mxf’, options: ‘-pix_fmt vvvv’ },
{ file: ‘123.mxf’, options: ‘-pix_fmt aaaa’ } ]
TypeError: task.variables.set is not a function

Hi @hados,

a common pattern is create a new Variables object and pass the result from your service here to the task.

Have a look at this example:

Hope this helps, Ingo