I need to pass variable from webapp js to workflow js , we are using an external signal to trigger the workflow from webapp javascript.
when we use vars.variablename
xtk.workflow.PostEvent('calledWorkflow','signal','', <variables varName= {vars.xyz} />,false)
it shows an error in webapp as it does not allow vars.variablename.
we have also tried ctx variable but in the workflow it is coming as undefined.
Solved! Go to Solution.
On your webapp
var abc= ctx.vars.abc; var xyz= ctx.vars.xyz; NLWS.xtkWorkflow.PostEvent("yourworkflow", "yoursignal", "", {variables: {"abc":abc, "xyz" xyz, }}, false);
On your workflow
logInfo(vars.abc+vars.xyz)
Hi @Prateek789
You can try storing the ctx variables in some variable (eg. var A = ctx.abc) and then try to call it in the Post event or you can also try storing the output in some Option Variables and use them in your workflow.
Regards
Views
Replies
Total Likes
Hello @Prateek789 ,
webapps do not have worklfow variables like vars. or instance.vars. they use ctx.vars. the postEvent is correct just push local variable (var xyz) or push context variable to the function (ctx.vars.xyz)
Marcel Szimonisz
MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/
On your webapp
var abc= ctx.vars.abc; var xyz= ctx.vars.xyz; NLWS.xtkWorkflow.PostEvent("yourworkflow", "yoursignal", "", {variables: {"abc":abc, "xyz" xyz, }}, false);
On your workflow
logInfo(vars.abc+vars.xyz)
Hi @Prateek789,
Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know. In case the given solutions were helpful, then kindly choose the one that helped you the most as the 'Correct Reply'.
Thanks!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies