Skip to content

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

PropertyTypeRequiredDescription
namestringYesThe 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
descriptionstringNoThe description of the executor
triggerobjectYesThe type of trigger (e.g., recordCreatedTrigger, webhookTrigger, scheduleTrigger)

Function Operation Properties

PropertyTypeRequiredDescription
kindstringYesMust be "function" for function operations
bodyfunctionYesAn async function containing the business logic. Receives trigger context (e.g., newRecord, oldRecord) as parameters

Executor Properties

PropertyTypeRequiredDescription
namestringYesThe 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_idstringYesThe ID of the workspace that the executor namespace belongs to
descriptionstringNoThe description of the executor
triggerobjectYesThe type of trigger (webhook, event, or schedule)

Function Operation Properties

PropertyTypeSupports ScriptingRequiredDescription
namestring-YesThe name of the function
scriptstring-YesThe JavaScript/TypeScript code to execute
invokerobject-NoThe invoker of the operation
variablesstringJavaScript / CELNoThe variables to pass to the function. Can access trigger-specific data via args object

Executor Properties

PropertyTypeRequiredDescription
NamestringYesThe 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
DescriptionstringNoThe description of the executor
TriggerobjectYesThe type of trigger (e.g., #TriggerIncomingWebhook, #TriggerEvent, #TriggerSchedule)

TargetFunction Properties

PropertyTypeSupports ScriptingRequiredDescription
Namestring-YesThe name of the function
ScriptPathstring-YesThe path to the JavaScript/TypeScript script file
Invokerobject-NoThe invoker of the operation
VariablesstringJavaScript / CELNoThe variables to pass to the function. Can access trigger-specific data via args object