Deliver Data Step
Use this to write workflow data back to your organization's data source. Should be used to insert new records, update existing ones, upsert data conditionally, or skip operations based on your workflow logic. The step supports mapping workflow fields to dataset entity properties with type-aware transformations.
Top-level properties
| name | type | required | constraints | description |
|---|---|---|---|---|
datasets | array | yes | items: dataset | One or more dataset operations to perform |
Dataset
| name | type | required | constraints | description |
|---|---|---|---|---|
datasetId | string | yes | Identifier of the target dataset | |
selectedSearchDataStep | string | no | nullable: true | Reference to a data search step that provides context |
stepDatasetInstanceId | string | no | nullable: true | Specific dataset instance identifier for this workflow step |
entities | array | yes | items: datasetEntity | Entity operations to perform on this dataset |
Dataset Entity
| name | type | required | constraints | description |
|---|---|---|---|---|
linkId | string | no | nullable: true | Optional link to related entity or record |
entityId | string | yes | Identifier of the entity type being written | |
operation | string | yes | enum: INSERT, UPDATE, UPSERT, SKIP | Operation to perform on this entity |
mappings | array | yes | items: mapping | Field mappings from workflow data to entity properties |
Operations
INSERT: Create a new record in the datasetUPDATE: Modify an existing record (requires key field match)UPSERT: Insert if new, update if exists (based on key fields)SKIP: No operation; useful for conditional logic branches
Mapping
| name | type | required | constraints | description |
|---|---|---|---|---|
fieldId | string | yes | nullable: true | Dataset field identifier being mapped to |
value | string | yes | nullable: true | Workflow field or literal value to write |
isKeyField | boolean | yes | Whether this field is part of the entity's primary key | |
primitiveType | string | yes | nullable: true | Primitive data type hint (e.g., string, number, boolean) |
complexType | string | yes | nullable: true | Complex or custom type hint for advanced transformations |
Minimal Example (JSON)
{
"datasets": [
{
"datasetId": "contacts_db",
"selectedSearchDataStep": null,
"stepDatasetInstanceId": null,
"entities": [
{
"linkId": null,
"entityId": "contact",
"operation": "INSERT",
"mappings": [
{
"fieldId": "email",
"value": "[email protected]",
"isKeyField": true,
"primitiveType": "string",
"complexType": null
}
]
}
]
}
]
}Full Example (JSON)
{
"datasets": [
{
"datasetId": "customer_records",
"selectedSearchDataStep": "search_step_123",
"stepDatasetInstanceId": "instance_456",
"entities": [
{
"linkId": "link_789",
"entityId": "customer",
"operation": "UPSERT",
"mappings": [
{
"fieldId": "customer_id",
"value": "{{`form`.`customer_id`}}",
"isKeyField": true,
"primitiveType": "string",
"complexType": null
},
{
"fieldId": "full_name",
"value": "{{`form`.`first_name`}} {{`form`.`last_name`}}",
"isKeyField": false,
"primitiveType": "string",
"complexType": null
},
{
"fieldId": "email",
"value": "{{`form`.`email`}}",
"isKeyField": false,
"primitiveType": "string",
"complexType": "email"
},
{
"fieldId": "subscription_count",
"value": "{{`form`.`subscriptions.length`}}",
"isKeyField": false,
"primitiveType": "number",
"complexType": "integer"
},
{
"fieldId": "is_active",
"value": "true",
"isKeyField": false,
"primitiveType": "boolean",
"complexType": null
}
]
},
{
"linkId": null,
"entityId": "audit_log",
"operation": "INSERT",
"mappings": [
{
"fieldId": "timestamp",
"value": "{{`workflow`.`timestamp`}}",
"isKeyField": false,
"primitiveType": "string",
"complexType": "datetime"
},
{
"fieldId": "action",
"value": "customer_updated",
"isKeyField": false,
"primitiveType": "string",
"complexType": null
}
]
}
]
}
]
}TypeScript Example
import { writeOutConfig, type WriteOutConfig } from '@odin/workflows-schema';
const deliverDataStep: WriteOutConfig = {
datasets: [
{
datasetId: 'sales_leads',
selectedSearchDataStep: null,
stepDatasetInstanceId: null,
entities: [
{
linkId: null,
entityId: 'lead',
operation: 'INSERT',
mappings: [
{
fieldId: 'lead_id',
value: '`{{`form`.`lead_id`}}',
isKeyField: true,
primitiveType: 'string',
complexType: null,
},
{
fieldId: 'company_name',
value: '{{`form`.`company`}}',
isKeyField: false,
primitiveType: 'string',
complexType: null,
},
{
fieldId: 'lead_score',
value: '{{`form`.`score`}}',
isKeyField: false,
primitiveType: 'number',
complexType: 'integer',
},
],
},
],
},
],
};Updated 15 days ago
