***

title: updateGlobalData
slug: /reference/typescript/agents/function-result/update-global-data
description: Set or update key-value pairs in the global session data.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[functionresult]: /docs/server-sdks/reference/typescript/agents/function-result

Set or update key-value pairs in the global session data. Global data persists
for the entire agent session and is accessible in prompt variable expansion
(`${global_data.key}`) and by all SWAIG functions.

## **Parameters**

<ParamField path="data" type={"Record<string, unknown>"} required={true} toc={true}>
  Object of key-value pairs to merge into the global data store. Existing
  keys are overwritten; new keys are added.
</ParamField>

## **Returns**

[`FunctionResult`][functionresult] -- `this`, for chaining.

## **Example**

```typescript {4}
import { FunctionResult } from '@signalwire/sdk';

const result = new FunctionResult('Data updated.')
  .updateGlobalData({ customer_name: 'John', status: 'verified' });
```