Hi, I’m 2 weeks into WeWeb and loving it so far!
However, I am having one problem I would like some help with.
I am trying to execute a workflow from inside Custom JS but having problems. Looked through some topics but couldn’t find a solution.
In one of my text fields I have the values binded to some Custom JS.
However, when I try to run wwLib.wwWorkflow.executeGlobal('my workflow id',{['block_id']:'123test'});
, not only does it not show anything the browzer freezes.
This code did work in the Console in the browser, so the code itself seems to be good.
What I did was just paste the code to the Custom JS editor and it freezes.
I checked to see if there was any looping going on somewhere but I am just executing a workflow to update a variable and after the variable updates it is not used for anything(yet).
Thanks in advance for anyones help!
Hello, your code seems to be wrong, try it this way:
wwLib.executeWorkflow('workflowID', {myParam: 'Link A'})
some quick thoughts about this: workflows have static known parameters so dynamic keys notation for the object has little utility here.
workflows are async functions so they are not the best to set direct bound values, a function with sync code if better for that.
if the editor freezes you probably have an infinite recursion, so double check your code, workflow and bound values
Thanks for you input!
Acctually I did try this and the same things were happening. And in the Console it told me that the ‘executeWorkflow’ function was depricated so use ‘executeGlobal’, they both did work in the Console but not in the weweb editor. I’ll look in to it further! Thanks!
Thank you for replying! I’ll double check my code and work flows, but it did work in the console, so I’ll try to dig into what might be going wrong.
I am looking for a workaroud to complete this custom logic in the backend(Xano) which would be safer anyways. Thank you!
what did work in the console? workflows are async functions, bound values are sync functions, so the logic in your workflow can be correct and you can log something in the console but it is different from actually returning a value and it probably won’t work as expected (there was an old post saying that bound values should only use sync functions)