Pipeline Query
Execute a query, create a materialized view, and optionally write results to an Object with flexible field mappings
Pipeline Query
Execute a query and create a materialized view for use in subsequent workflow steps. Optionally write query results directly to an Object with flexible field mappings supporting constants, runtime values, and node field references.
Technical Name: PipelineQueryFunc
Properties
- Execution Mode: SYNC
- Type: NATIVE
- Category: System Functions
- Function ID:
1b4ff763-94ad-4726-8dbe-c95a65ad0c00
Input Schema
Required Parameters
| Parameter | Type | Description |
|---|---|---|
queryMaster | object | Query configuration object for building the SQL query |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
writeToMobject | object | Configuration to write query results to an Object |
WriteToMobject Configuration
| Parameter | Type | Description |
|---|---|---|
mobjectId | string (uuid) | ID of the target Object to write data to |
fieldMappings | array | Array of field mappings between source query and target Object |
Field Mapping Properties
| Parameter | Type | Description |
|---|---|---|
mobjectField | string | Name of the field in the target Object (required) |
sourceType | string | Type of source: "FIELD", "CONSTANT", "RUNTIME_CONSTANT", or "NODE_FIELD" (required) |
sourceField | string | Name of the field from query results (required if sourceType is FIELD) |
constantValue | string | Constant value to use (required if sourceType is CONSTANT) |
runtimeConstantKey | string | Runtime constant key (required if sourceType is RUNTIME_CONSTANT) |
nodeFieldId | string | Node field identifier in format "nodeId->fieldName" (required if sourceType is NODE_FIELD) |
[Image placeholder: PipelineQuery function configuration panel]
Source Types
FIELD
Map a field directly from the query results:
{
"mobjectField": "customerName",
"sourceType": "FIELD",
"sourceField": "name"
}CONSTANT
Use a constant value:
{
"mobjectField": "status",
"sourceType": "CONSTANT",
"constantValue": "Active"
}RUNTIME_CONSTANT
Use a runtime constant value:
Available Runtime Constants:
CURRENT_USER- Current user's usernameCURRENT_USER_ID- Current user's IDCURRENT_ROLE- Current user's role names (comma-separated)CURRENT_ROLE_ID- Current user's role IDCURRENT_TIMESTAMP- Current local timestampCURRENT_UTC_TIMESTAMP- Current UTC timestampTODAY- Current dateEXECUTION_ID- Current workflow execution IDREQUEST_ID- Current request ID
{
"mobjectField": "createdBy",
"sourceType": "RUNTIME_CONSTANT",
"runtimeConstantKey": "CURRENT_USER_ID"
}NODE_FIELD
Reference a field from a previous workflow node:
{
"mobjectField": "orderId",
"sourceType": "NODE_FIELD",
"nodeFieldId": "node-123->orderId"
}Input Example
Query Only (Create Materialized View)
{
"queryMaster": {
"selectFields": [
{
"fieldName": "name",
"fieldAlias": "customerName"
},
{
"fieldName": "email",
"fieldAlias": "email"
}
],
"fromClause": {
"mobjectId": "customer-mobject-uuid"
}
}
}Query with Write to Object
{
"queryMaster": {
"selectFields": [
{"fieldName": "name", "fieldAlias": "customerName"},
{"fieldName": "email", "fieldAlias": "email"}
],
"fromClause": {
"mobjectId": "customer-mobject-uuid"
}
},
"writeToMobject": {
"mobjectId": "report-mobject-uuid",
"fieldMappings": [
{
"mobjectField": "customerName",
"sourceType": "FIELD",
"sourceField": "customerName"
},
{
"mobjectField": "email",
"sourceType": "FIELD",
"sourceField": "email"
},
{
"mobjectField": "status",
"sourceType": "CONSTANT",
"constantValue": "Processed"
},
{
"mobjectField": "createdBy",
"sourceType": "RUNTIME_CONSTANT",
"runtimeConstantKey": "CURRENT_USER_ID"
}
]
}
}Output Schema
| Field | Type | Description |
|---|---|---|
viewName | string | Generated materialized view name (can be used in subsequent queries) |
sql | string | The SQL query that was executed |
rowsInserted | integer | Number of rows inserted into Object (only if writeToMobject was configured) |
writeSuccess | boolean | Whether the write operation was successful (only if writeToMobject was configured) |
Output Example
Query Only
{
"viewName": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"sql": "SELECT name AS customerName, email FROM customer_table WHERE status = 'Active'"
}With Write to Object
{
"viewName": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"sql": "SELECT name AS customerName, email FROM customer_table WHERE status = 'Active'",
"rowsInserted": 150,
"writeSuccess": true
}[Image placeholder: Pipeline query output visualization]
How It Works
- Query Execution: Executes the query defined in
queryMaster - Materialized View Creation: Creates a materialized view with a unique name
- Optional Write Operation: If
writeToMobjectis configured:- Maps query fields to Object fields using field mappings
- Supports constants, runtime values, and node field references
- Creates data ownership records automatically
- Inserts records into the target Object
Use Cases
Create Reusable Query View
Create a materialized view for use in multiple workflow steps:
{
"queryMaster": {
"selectFields": [
{"fieldName": "orderNumber", "fieldAlias": "Order"},
{"fieldName": "totalAmount", "fieldAlias": "Amount"}
],
"fromClause": {
"mobjectId": "order-mobject-uuid"
},
"where": [
{
"field": "status",
"operator": "equals",
"value": "Completed"
}
]
}
}Transform and Load Data
Query data, transform it, and write to another Object:
Start → PipelineQuery(Query + Write) → ProcessResults → EndUse Runtime Values
Populate audit fields automatically:
{
"queryMaster": {...},
"writeToMobject": {
"mobjectId": "audit-mobject-uuid",
"fieldMappings": [
{
"mobjectField": "createdBy",
"sourceType": "RUNTIME_CONSTANT",
"runtimeConstantKey": "CURRENT_USER_ID"
},
{
"mobjectField": "createdAt",
"sourceType": "RUNTIME_CONSTANT",
"runtimeConstantKey": "CURRENT_TIMESTAMP"
}
]
}
}[Image placeholder: Workflow examples]
Materialized View Usage
The generated viewName can be used in subsequent queries:
SELECT * FROM "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"Data Ownership
When writing to Object, the function automatically:
- Creates data ownership records for the current organization
- Sets system fields (created_at, created_by, updated_at, updated_by, deleted)
- Ensures proper data isolation across organizations
Related Functions
- Get Multiple Records - Query data without creating a view
- Insert MData - Insert individual records
- Bulk Insert MData - Bulk insert records