Function Operation
The Function operation executes JavaScript/TypeScript code synchronously via the Function Service. Functions return results directly and are ideal for custom business logic that cannot be expressed in GraphQL, data transformations, integration with external APIs, and complex calculations.
For more details on writing functions, refer to the Function Service documentation.
Configuration Example
typescript
createExecutor({
name: "function-executor",
description: "Execute synchronous function",
trigger: recordCreatedTrigger({ type: dataRecord }),
operation: {
kind: "function",
body: async ({ newRecord }) => {
// Process the data
const data = newRecord;
const timestamp = new Date().toISOString();
// Function logic here
return { data, timestamp };
},
},
});Properties
Executor Properties
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The name of the executor. The name field has the validation rule ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$, and it does not allow capital letters |
description | string | No | The description of the executor |
trigger | object | Yes | The type of trigger (e.g., recordCreatedTrigger, webhookTrigger, scheduleTrigger) |
Function Operation Properties
| Property | Type | Required | Description |
|---|---|---|---|
kind | string | Yes | Must be "function" for function operations |
body | function | Yes | An async function containing the business logic. Receives trigger context (e.g., newRecord, oldRecord) as parameters |
Executor Properties
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The name of the executor. The name field has the validation rule ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$, and it does not allow capital letters |
workspace_id | string | Yes | The ID of the workspace that the executor namespace belongs to |
description | string | No | The description of the executor |
trigger | object | Yes | The type of trigger (webhook, event, or schedule) |
Function Operation Properties
| Property | Type | Supports Scripting | Required | Description |
|---|---|---|---|---|
name | string | - | Yes | The name of the function |
script | string | - | Yes | The JavaScript/TypeScript code to execute |
invoker | object | - | No | The invoker of the operation |
variables | string | JavaScript / CEL | No | The variables to pass to the function. Can access trigger-specific data via args object |
Executor Properties
| Property | Type | Required | Description |
|---|---|---|---|
Name | string | Yes | The name of the executor. The name field has the validation rule ^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$, and it does not allow capital letters |
Description | string | No | The description of the executor |
Trigger | object | Yes | The type of trigger (e.g., #TriggerIncomingWebhook, #TriggerEvent, #TriggerSchedule) |
TargetFunction Properties
| Property | Type | Supports Scripting | Required | Description |
|---|---|---|---|---|
Name | string | - | Yes | The name of the function |
ScriptPath | string | - | Yes | The path to the JavaScript/TypeScript script file |
Invoker | object | - | No | The invoker of the operation |
Variables | string | JavaScript / CEL | No | The variables to pass to the function. Can access trigger-specific data via args object |