How to write parameters in wwLib.executeWorkflow?

Couldn’t find anywhere how to write the parameters in wwLib.executeWorkflow(). Is it something like: wwLib.executeWorkflow('d43e2cda-2e70-4340-bf20-591717b09b9d',{'param1':'value', 'param2':'value'}?


Thank you @dorilama
For some reason my code isn’t working:

"Go to the <u onclick='wwLib.executeWorkflow(`d43e2cda-2e70-4340-bf20-591717b09b9d`,{`department_slug`:`hr`,`loader_message`:`Human ressources`})'>Human ressources</u> department"

Logs say that department_slug parameter is missing.

Also, this code seems to make my editor crash :face_with_raised_eyebrow:

EDIT: now the editor doesn’t crash and there’s no log; the workflow just won’t get triggered. Code remains the same.

when you create the object you can’t use template literals for object name unless you treat them as dynamic keys.
this is what works: {a:1, 'b':1, "c":1, [`d`]:1 }

So this should work?


I can’t use " or ' since they’re used in my formula.
It doesn’t trigger the workflow on my side.

You need to “wrap” ‘it’ but not in `back ticks`

you need to use valid js: strings need to be wrapped in quotes, the id of the workflow and the values of the object properties (if strings) must be wrapped in quotes (single or double) or backticks.
the keys of the property must be valid js variable names, or be wrapped in quotes (single or double). if you want to use backticks you need to treat the key as a dynamic key like my previous example.

I’ve tried multiple combinations, such as


With this code, the workflow does get triggered, but the value of department_slug doesn’t get through. No other combinations has worked.

If I used " it would escape the formula (which starts with ").
If I used ' it would escape the onclick attribute.

you are trying random stuff without understanding what you are doing. when you leave the nocode way it is good to have a grasp of the basics of the coding language you use or you will end up wasting time like this.
try this: wwLib.executeWorkflow(`workflow-id-as-template-literal-string`, {[`your parameter key with arbitrary characters`]: `your value, assuming it is a string and not an array of strings`}

1 Like

It works! Thank you @dorilama

great :+1: