# Global Variables with Scheduled Runs

**URL:** <https://community.postman.com/t/global-variables-with-scheduled-runs/42589>\
**Category:** Help Hub\
**Tags:** global-variable, scheduler\
**Created:** [January 4, 2023, 5:55pm UTC](https://community.postman.com/t/global-variables-with-scheduled-runs/42589 "2023-01-04T17:55:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dd990](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dd990](https://community.postman.com/u/dd990)\
**Post date:** [January 4, 2023, 5:55pm UTC](https://community.postman.com/t/global-variables-with-scheduled-runs/42589/1 "2023-01-04T17:55:27Z")

</div>

Is there a way to use global variables with a scheduled collection run?

I’ve set up a Workspace for exchanging data between two eCommerce platforms and I’ve built separate collections to handle the different types of exchanges. For example, one collection handles the exchange of inventory data and another handles order-related exchanges. Since all collections use the same base URLs, I’ve set them up as global variables, e.g., baseURL\_A, baseURL\_B, etc. Then, each request uses these base URL variables plus the specific end path it needs to access (e.g., {{baseURL\_A}}/inventory, {{baseURL\_A}}/orders).

When I run these collections manually using the Collection Runner, they complete successfully. However, when I run them as a Scheduled run, they fail and a quick glance at the results in the Console reveals the reason: the variables are not being replaced with their assigned values, so instead of a URL being input as _myURL/api/inventory_, it’s entered as _http://%7B%7BbaseURL\_A%7D%7D/api/inventory_. Clearly the global variables are not being recognized here.

I have found other threads ([1](https://community.postman.com/t/typeerror-cannot-read-property-links-of-undefined-only-when-using-scheduled-runs/41437), [2](https://community.postman.com/t/chaining-request-not-working-when-the-collection-is-scheduled-to-run/41803)) on the forum that indicate the reason is due to the fact that Scheduled runs execute in the Postman Cloud, so they can’t access global variables.

Does anyone know of a way to get these global variables to work with Scheduled runs? I could change them to Collection variables, but then I would have to add them to each collection even though they are identical values, which is why I thought this would be a perfect application for global variables. Is there a workaround or another method that allows multiple collections to share variables while also working with Scheduled runs?

Any thoughts?

---

<div class="post-metadata">

**Author:** ![gsamardjieva](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/gsamardjieva/32/15111_2.png) [@gsamardjieva](https://community.postman.com/u/gsamardjieva)\
**Post date:** [March 8, 2023, 12:25pm UTC](https://community.postman.com/t/global-variables-with-scheduled-runs/42589/2 "2023-03-08T12:25:15Z")

</div>

I have the same problem.  
Do you solve your problem?

---

<div class="post-metadata">

**Author:** ![dd990](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dd990](https://community.postman.com/u/dd990)\
**Post date:** [March 8, 2023, 2:30pm UTC](https://community.postman.com/t/global-variables-with-scheduled-runs/42589/3 "2023-03-08T14:30:37Z")

</div>

Apparently Global Variables cannot be used with scheduled runs, but I was able to work around this limitation by changing the variables to Environment Variables. Environment Variables offer similar functionality to Globals, but you just need to select the environment before you send the requests. So when manually sending requests, you need to first select the Environment at the top-right corner of the Postman page. With Scheduled runs/Monitors, there is an Environment setting there as well; just select the Environment that has the variables that are needed for that run.

I hope this helps!

---

<div class="post-metadata">

**Author:** ![doug](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@doug](https://community.postman.com/u/doug)\
**Post date:** [September 2, 2023, 1:36pm UTC](https://community.postman.com/t/global-variables-with-scheduled-runs/42589/4 "2023-09-02T13:36:25Z")

</div>

I can get variables to work when I **manually** run.  
They can **increment** and all is good.

But as soon as the same script runs **scheduled** from the cloud, the variables are always not saved.  
I’ve tried **Globals** - (which I’m told don’t work for scheduled)  
So I tried **collection** variables.  
And I’ve tried **environment** variables.

Same result.

What is going on please?

---

<div class="post-metadata">

**Author:** ![dd990](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@dd990](https://community.postman.com/u/dd990)\
**Post date:** [September 5, 2023, 1:42pm UTC](https://community.postman.com/t/global-variables-with-scheduled-runs/42589/5 "2023-09-05T13:42:12Z")

</div>

> [@doug](#):
>
> I can get variables to work when I **manually** run.  
> They can **increment** and all is good.
> 
> But as soon as the same script runs **scheduled** from the cloud, the variables are always not saved.  
> I’ve tried **Globals** - (which I’m told don’t work for scheduled)  
> So I tried **collection** variables.  
> And I’ve tried **environment** variables.
> 
> Same result.
> 
> What is going on please?

Switching to Environment variables solved my problem. When you tried that did you make sure to select the environment in the scheduled run settings?

---

<div class="post-metadata">

**Author:** ![vegconomist](https://avatars.discourse-cdn.com/v4/letter/v/a87d85/32.png) [@vegconomist](https://community.postman.com/u/vegconomist)\
**Post date:** [September 23, 2023, 5:46pm UTC](https://community.postman.com/t/global-variables-with-scheduled-runs/42589/6 "2023-09-23T17:46:30Z")

</div>

> can get variables to work when I **manually** run.  
> They can **increment** and all is good.
> 
> But as soon as the same script runs **scheduled** from the cloud, the variables are always not saved.  
> I’ve tried **Globals** - (which I’m told don’t work for scheduled)  
> So I tried **collection** variables.  
> And I’ve tried **environment** variables.
> 
> Same result.

I have the exact same issue.  
I double-checked to have the correct Environment set, but I can’t access the Environment variables with scheduled runs…

Also, it’s quite counterintuitive for GLOBAL variables not to be accessible when running scheduled runs.  
Or maybe it is… Because the cloud is not part of the GLOBe? 🙄

---

<div class="post-metadata">

**Author:** ![simonlmmv](https://avatars.discourse-cdn.com/v4/letter/s/ac8455/32.png) [@simonlmmv](https://community.postman.com/u/simonlmmv)\
**Post date:** [October 17, 2024, 3:46pm UTC](https://community.postman.com/t/global-variables-with-scheduled-runs/42589/7 "2024-10-17T15:46:20Z")

</div>

Using global variables or environment variables or collection variables didn’t work for scheduled runs on my side. I had to use **Persist** for the variables of the environment that I wanted to use : Read =\> [Store and reuse values using variables | Postman Learning Center](https://learning.postman.com/docs/sending-requests/variables/variables/#sharing-and-persisting-data)

Using **Persist** makes your current value [sync](https://learning.postman.com/docs/getting-started/basics/syncing/) with Postman’s servers and be reflected for anyone sharing your collection or environment. To reset your current local values to reflect the initial shared values, use **Reset**.

I hope it helps you guys !
