**Source URL:** https://general.veevavault.dev/commercial/custom-pages/vault-web-sdk/25.1.2/type-aliases/sendevent

# SendEvent

> **SendEvent** = (`eventName`, `data?`) => `Promise`<{ `data?`: `unknown`; }>

. Client to fire events that the Vault Java SDK PageController onEvent method handles.

## Parameters

### eventName

`string`

The name of the event

### data?

`unknown`

JSON data send to the server event handler

## Returns

`Promise`<{ `data?`: `unknown`; }>

A JsonObject which is returned from the response from the Vault Java SDK onEvent method

## Example

```js
    try {
            const response = await sendEvent("myEvent", {
                 myNumValue: 1,
                 myStringValue: "hello"
            });

            if (response?.data) {
                console.log("onEvent returned data");
            } else {
                console.log("onEvent returned without data");
            }
        } catch (e) {
            console.log('sendEvent error: ', e);
        }
```

---

**Previous:** [Type Aliases](/commercial/custom-pages/vault-web-sdk/25.1.2/type-aliases)  
**Next:** [Variables](/commercial/custom-pages/vault-web-sdk/25.1.2/variables)