flow and context variable differences

Not applicable

I read the documentation, but could not understand when to use context.getVariable/setVariable and when to use flow.getVariable/setVariable?

in Javascript on respose flow, If I use below code is that right.

var a=context.getVariable(response.content);

does above code puts the value of response into variable a?

0 2 2,192
2 REPLIES 2

@praveenkumar.kithuvaramesh

You set the custom flow variables using context.setVariable , Retrieve the flow variables using context.getVariable.

context.setVariable(),context.getVariable() are javascript functions that takes flow variable name as as string input & returns the value of that flow variable.

As far as i know, There is nothing like flow.getVariable/setVariable functions in javascript. I am not sure where you found these functions.

Ideally, You should be doing,

var a=context.getVariable("response.content");

Please refer our docs for more details. Hope it helps.

Thanks Anil.So you mean that a will have response contents after below line of code. Please confirm.

var a=context.getVariable("response.content");