# Difference between getWorkflowStaticData type global and node?

**URL:** <https://community.n8n.io/t/difference-between-getworkflowstaticdata-type-global-and-node/25619>\
**Category:** Questions\
**Tags:** core, node\
**Created:** [April 26, 2023, 3:59pm UTC](https://community.n8n.io/t/difference-between-getworkflowstaticdata-type-global-and-node/25619 "2023-04-26T15:59:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gouravdev](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gouravdev/32/14036_2.png) [@Gouravdev](https://community.n8n.io/u/Gouravdev)\
**Post date:** [April 26, 2023, 3:59pm UTC](https://community.n8n.io/t/difference-between-getworkflowstaticdata-type-global-and-node/25619/1 "2023-04-26T15:59:10Z")

</div>

## Describe the problem/error/question

Hi Team,

I need to understand the difference between `$getWorkflowStaticData('global')` and `$getWorkflowStaticData('node')`. I have read the [https://docs.n8n.io/code-examples/methods-variables-examples/get-workflow-static-data/](https://docs.n8n.io/code-examples/methods-variables-examples/get-workflow-static-data/) article, but the results I am getting do not match what is described.

Thank you.

## What is the error message (if any)?

NO

## Please share your workflow

## Share the output returned by the last node

I’ve add this code for different workflow,  
When I run it for one workflow the value should be

- executionTimeStamp: 2023-04-26T12:11:43.398Z
- lastExecution: 1990-01-01T00:00:00.000Z  
**BUT**
- executionTimeStamp: 2023-04-26T12:11:43.398Z
- lastExecution: 2023-04-26T12:11:42.398Z ( it’s fetching the value from the another workflow last execution)

## Information on your n8n setup

- **n8n version:**
- **Database (default: SQLite):**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app):**
- **Operating system:**

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [April 27, 2023, 7:55am UTC](https://community.n8n.io/t/difference-between-getworkflowstaticdata-type-global-and-node/25619/2 "2023-04-27T07:55:11Z")

</div>

Hi @Gouravdev, are you manually executing your workflow? Static data wouldn’t be available when doing so, making it rather hard to build and debug workflows relying on this.

So personally, I’d suggest you use an external datastore (any database would do) whenever you need to store data across multiple workflow executions.

---

<div class="post-metadata">

**Author:** ![Gouravdev](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gouravdev/32/14036_2.png) [@Gouravdev](https://community.n8n.io/u/Gouravdev)\
**Post date:** [April 27, 2023, 8:28am UTC](https://community.n8n.io/t/difference-between-getworkflowstaticdata-type-global-and-node/25619/3 "2023-04-27T08:28:03Z")

</div>

Hi @MutedJam  
No, the workflow is active and trigger on the cron job node.

my one workflow lastexcution time override the other workflow time.

When I run it for one workflow for the first time the value should be

- executionTimeStamp: 2023-04-26T12:11:43.398Z
- lastExecution: 1990-01-01T00:00:00.000Z  
**BUT**
- executionTimeStamp: 2023-04-26T12:11:43.398Z
- lastExecution: 2023-04-26T12:11:42.398Z ( it’s fetching the value from the another workflow last execution)

is it possible to have the last execution based on the workflow specific not global.

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [April 27, 2023, 8:35am UTC](https://community.n8n.io/t/difference-between-getworkflowstaticdata-type-global-and-node/25619/4 "2023-04-27T08:35:19Z")

</div>

Hi @Gouravdev, both of your Function Item nodes use `getWorkflowStaticData('global'); `, so I am not sure what exactly you are expecting here tbh and where `$getWorkflowStaticData('node')` comes into play.

I just tried running your workflow only once (with a webhook trigger, so I can control more easily when it runs) and this is the result:

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/e/b/ebb3258260f2b96e4ad03ae2402a6894a28831aa.png)

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/4/f/4f509587c9083bbb5b98e47d4a30af7eac6b943d.png)

So the `lastExecution` value is set as expected for me.

As mentioned, my suggestion here would be to use an external database instead to avoid the confusion coming with static data.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/36532_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [May 4, 2023, 8:35am UTC](https://community.n8n.io/t/difference-between-getworkflowstaticdata-type-global-and-node/25619/5 "2023-05-04T08:35:40Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
