Skip to content
View as Markdown

Job Function Operation ​

The Job Function operation executes JavaScript or TypeScript code via the Function Service with an execution limit of 5 minutes, longer than the 60-second limit of a function operation. It is typically used for tasks that need more than 60 seconds to complete, and for background processes triggered by events or schedules.

Unlike synchronous functions, which return results directly, a Job Function returns an execution ID that can be used to track the status of the task.

For more details on writing functions, refer to the Function Service documentation.

Need more than 5 minutes?

A single job function is capped at 5 minutes. For longer work, split it into steps of 5 minutes or less and orchestrate them with a Workflow, which can retry failed steps and resume from where it stopped, running for minutes to hours.

Configuration Example ​

typescript
createExecutor({
  name: "job-function-executor",
  description: "Execute job function",
  trigger: scheduleTrigger({ cron: "0 0 * * *" }),
  operation: {
    kind: "jobFunction",
    body: async () => {
      // Task logic (runs up to 5 minutes)
      const taskId = `task-${Date.now()}`;
      const timestamp = new Date().toISOString();
      // Background processing logic here
    },
  },
});

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., scheduleTrigger, recordCreatedTrigger, incomingWebhookTrigger)

Job Function Operation Properties

PropertyTypeRequiredDescription
kindstringYesMust be "jobFunction" for job function operations
bodyfunctionYesAn async function containing the task logic

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)

Job Function Operation Properties

PropertyTypeSupports ScriptingRequiredDescription
namestring-YesThe name of the job function
scriptstring-YesThe JavaScript/TypeScript code to execute
invokerobject-NoThe invoker of the operation
variablesstringJavaScript / CELNoThe variables to pass to the job 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)

TargetJobFunction Properties

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

Concurrency ​

Up to 100 job function operations run concurrently per workspace, regardless of trigger type. Executions beyond the limit are never rejected — they are queued and start automatically, oldest first, as running executions complete. This means a large burst (for example, a bulk import fanning out into thousands of event-triggered executions) is processed at a steady rate rather than all at once, and executions may start minutes after they were triggered. Design time-sensitive integrations to react to completion events rather than assuming a fixed completion time.

See Platform Limits for details.

Use Cases ​

Job functions are ideal for:

  • Work beyond the 60-second limit: Tasks that need more time than a function operation allows, running up to 5 minutes
  • Background processing: Operations that don't require immediate response
  • Batch processing: Processing large datasets or multiple records
  • External API integrations: Calling external services that may have high latency
  • File processing: Uploading, downloading, or transforming files
  • Email notifications: Sending emails or other notifications
  • Data synchronization: Syncing data between systems