# Execute workflow for inside custom javscript

**URL:** <https://community.weweb.io/t/execute-workflow-for-inside-custom-javscript/18170>\
**Category:** Ask us anything\
**Created:** [May 7, 2025, 1:32pm UTC](https://community.weweb.io/t/execute-workflow-for-inside-custom-javscript/18170 "2025-05-07T13:32:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![divyanshkumarbohz](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@divyanshkumarbohz](https://community.weweb.io/u/divyanshkumarbohz)\
**Post date:** [May 7, 2025, 1:32pm UTC](https://community.weweb.io/t/execute-workflow-for-inside-custom-javscript/18170/1 "2025-05-07T13:32:21Z")

</div>

Hi everyone,

I’m currently working on executing workflows from inside custom JavaScript in WeWeb and need guidance on the best practices and alternative approaches for triggering a specific workflow.

In particular, I’m working on custom markers for a map integration and need to ensure that certain workflows are triggered correctly based on user interactions with the map.

I’ve recorded a **Loom video** explaining the issue in more detail—you can check it out here:  
https://www.loom.com/embed/ac5fe29b76e3497a8ebabe831b65f826?sid=418b9542-d9e7-47fa-a5fb-3c4615443d31

Would love to hear any recommendations on efficient and reliable methods for handling workflow execution within JavaScript inside WeWeb.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![DanielL](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/daniell/32/13398_2.png) [@DanielL](https://community.weweb.io/u/DanielL)\
**Post date:** [May 7, 2025, 2:00pm UTC](https://community.weweb.io/t/execute-workflow-for-inside-custom-javscript/18170/2 "2025-05-07T14:00:18Z")

</div>

Hi @divyanshkumarbohz

You can execute workflows in js with wwLib, specifically wwLib.executeWorkflow(workflowId). You get the id by toggling “Show dev information”:

 ![dev](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/f/f015caf842d51ab502772bf1bfe235bc84dbd2f4.png)

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [May 7, 2025, 9:22pm UTC](https://community.weweb.io/t/execute-workflow-for-inside-custom-javscript/18170/3 "2025-05-07T21:22:58Z")

</div>

`wwLib.execiteWorkflow` was deprecated, right?

> [@Deprecated ww functions & upcoming improvements to the dev experience](https://community.weweb.io/t/deprecated-ww-functions-upcoming-improvements-to-the-dev-experience/9387/3):
>
> wwLib.executeWorkflow =\> wwLib.wwWorkflow.executeGlobal

my understanding is that `wwLib.wwWorkflow.executeGlobal` should be preferred going forward

---

<div class="post-metadata">

**Author:** ![DanielL](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/daniell/32/13398_2.png) [@DanielL](https://community.weweb.io/u/DanielL)\
**Post date:** [May 9, 2025, 12:28pm UTC](https://community.weweb.io/t/execute-workflow-for-inside-custom-javscript/18170/4 "2025-05-09T12:28:46Z")

</div>

Thanks @dorilama

I prefer wwLib.executeWorkflow because it’s more descriptive for beginners. We have no plans to remove the “deprecated” methods. It’s totally safe to use and it’s used by a lot of our clients.

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [May 9, 2025, 12:50pm UTC](https://community.weweb.io/t/execute-workflow-for-inside-custom-javscript/18170/5 "2025-05-09T12:50:52Z")

</div>

thanks for the clarification

---

<div class="post-metadata">

**Author:** ![divyanshkumarbohz](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@divyanshkumarbohz](https://community.weweb.io/u/divyanshkumarbohz)\
**Post date:** [May 10, 2025, 6:23am UTC](https://community.weweb.io/t/execute-workflow-for-inside-custom-javscript/18170/6 "2025-05-10T06:23:48Z")

</div>

@DanielL @dorilama Thanks for the quick responses, guys!

I’ve figured out my issue—I was attempting to run a workflow within a specific element using custom JavaScript, but I kept encountering the error: _“Workflow not found.”_ From what I understand, this approach isn’t currently possible.

However, setting up a global workflow within the action tab is working perfectly for me.
