# How do I run 'Fetch Collection' through Javascript?

**URL:** <https://community.weweb.io/t/how-do-i-run-fetch-collection-through-javascript/1927>\
**Category:** How do I?\
**Created:** [February 28, 2023, 4:48pm UTC](https://community.weweb.io/t/how-do-i-run-fetch-collection-through-javascript/1927 "2023-02-28T16:48:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![patopt](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@patopt](https://community.weweb.io/u/patopt)\
**Post date:** [February 28, 2023, 4:48pm UTC](https://community.weweb.io/t/how-do-i-run-fetch-collection-through-javascript/1927/1 "2023-02-28T16:48:32Z")

</div>

I have a javascript element i’m running for importing data, after I complete import I’d like to fetch the collection to show the new data. How can I run ‘Fetch Collection’ through javascript?

---

<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:** [February 28, 2023, 4:57pm UTC](https://community.weweb.io/t/how-do-i-run-fetch-collection-through-javascript/1927/2 "2023-02-28T16:57:02Z")

</div>

Weweb team recently added a way to trigger workflows from javascript: `wwLib.executeWorkflow(workflowUID)`. You can use this to trigger a global workflow and fetch the collection with that workflow.  
You can see an example of use [here](https://community.weweb.io/t/loop-until-condition-is-met/1564/5) and [here](https://community.weweb.io/t/best-place-for-onfocus-and-onblur-events/1625/2).

---

<div class="post-metadata">

**Author:** ![patopt](https://avatars.discourse-cdn.com/v4/letter/p/97f17d/32.png) [@patopt](https://community.weweb.io/u/patopt)\
**Post date:** [February 28, 2023, 5:06pm UTC](https://community.weweb.io/t/how-do-i-run-fetch-collection-through-javascript/1927/3 "2023-02-28T17:06:52Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![unlustucru](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@unlustucru](https://community.weweb.io/u/unlustucru)\
**Post date:** [April 22, 2024, 10:24am UTC](https://community.weweb.io/t/how-do-i-run-fetch-collection-through-javascript/1927/4 "2024-04-22T10:24:27Z")

</div>

@dorilama Isn’t there a way to just fetch the collection without having to set up a dedicated workflow?

---

<div class="post-metadata">

**Author:** ![GeovanyFerreira](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/geovanyferreira/32/13093_2.png) [@GeovanyFerreira](https://community.weweb.io/u/GeovanyFerreira)\
**Post date:** [April 22, 2024, 10:53am UTC](https://community.weweb.io/t/how-do-i-run-fetch-collection-through-javascript/1927/5 "2024-04-22T10:53:07Z")

</div>

hi @unlustucru,  
use the following code  
`wwLib.wwCollection.fetchCollection('collectionUID')`
