# Cant update getWorkflowStaticData('global') with Gmail Trigger

**URL:** <https://community.n8n.io/t/cant-update-getworkflowstaticdata-global-with-gmail-trigger/84422>\
**Category:** Questions\
**Created:** [March 5, 2025, 3:44am UTC](https://community.n8n.io/t/cant-update-getworkflowstaticdata-global-with-gmail-trigger/84422 "2025-03-05T03:44:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manage\_Bnb](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/manage_bnb/32/47188_2.png) [@Manage\_Bnb](https://community.n8n.io/u/Manage_Bnb)\
**Post date:** [March 5, 2025, 3:44am UTC](https://community.n8n.io/t/cant-update-getworkflowstaticdata-global-with-gmail-trigger/84422/1 "2025-03-05T03:44:49Z")

</div>

## Describe the problem/error/question

I created a workflow where in a gmail trigger will update the getWorkflowStaticData(‘global’). The problem is that gmail trigger does not update it. I already tested the workflow by turning on the active button.

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

There is no error message

## Please share your workflow

## Share the output returned by the last node

I was expecting the counter to be incremented by 1

## Information on your n8n setup

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

---

<div class="post-metadata">

**Author:** ![Olek](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/olek/32/59619_2.png) [@Olek](https://community.n8n.io/u/Olek)\
**Post date:** [March 5, 2025, 4:51pm UTC](https://community.n8n.io/t/cant-update-getworkflowstaticdata-global-with-gmail-trigger/84422/2 "2025-03-05T16:51:08Z")

</div>

I observe similar behaviour and was able to reproduce the case on n8n cloud v1.81.4.

I tested the active workflow properly triggering Google Sheet and Gmail triggers - similar behaviour.

The Code node javascript code:

```auto
const data = $getWorkflowStaticData('global');

const dataIn = JSON.stringify(data);
let branch;

if (data.counter) {
  data.counter++;
  branch = "increment";
} else {
  data.counter = 1
  branch = "INIT";
}

const dataOut = JSON.stringify(data);

// debugging details to observe in executions tab
return [{ 
  json: { 
    executionId: $execution.id,
    experimentCode: $input.first().json.Subject ?? $input.first().json.UUID4,
    dataIn, 
    branch, 
    dataOut, 
    counter: data.counter,
  } 
}];

```

I noticed however that any, even slightest change (e.g. delete or add a non-critical whitespace in the code, manipulating other nodes) to the workflow that is being saved afterwards “forces” the code to actually properly change the content of the workflow static data.

I assume the static data is widely used by others and if it was a bug, someone would have already reported it. What is it that @Manage_Bnb and I are very likely overlooking here?

Could someone from n8n team and/or community please look into this and explain?

Doc for reference: [getWorkflowStaticData | n8n Docs](https://docs.n8n.io/code/cookbook/builtin/get-workflow-static-data/)

Playground template:

---

<div class="post-metadata">

**Author:** ![Logan\_Belmont](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/logan_belmont/32/61833_2.png) [@Logan\_Belmont](https://community.n8n.io/u/Logan_Belmont)\
**Post date:** [March 6, 2025, 1:23am UTC](https://community.n8n.io/t/cant-update-getworkflowstaticdata-global-with-gmail-trigger/84422/3 "2025-03-06T01:23:29Z")

</div>

I was able to reproduce this error in n8n 1.80.5 docker installed. Whenever Gmail Trigger node is run for the first time, it actually updates the getWorkflowStaticData(‘global’). However, the next time it run it will not update getWorkflowStaticData(‘global’).

I tried to find some workaround in here and I found one. However I dont really like this workaround.

The workaround is using a Subworkflow node.

So this is how it looks like

So what it does it execute another workflow. The subworkflow looks like this

This is just a band-aid solution and I hope n8n devs will resolve this.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [June 4, 2025, 1:24am UTC](https://community.n8n.io/t/cant-update-getworkflowstaticdata-global-with-gmail-trigger/84422/4 "2025-06-04T01:24:17Z")

</div>

Closed on June 4, 2025, 1:24am UTC

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