Monetize360

Export Data to CSV

Execute a query and convert the result to a CSV file with field labels as headers

Export Data to CSV

Execute a query and convert the results to a CSV file. This function automatically resolves picklist values and uses field labels as CSV headers for better readability.

Technical Name: ExportFunc

Properties

  • Execution Mode: SYNC
  • Type: NATIVE
  • Category: System Functions
  • Function ID: 6b1f97d8-265e-48f9-b6ef-2267afc70244

Input Schema

Required Parameters

ParameterTypeDescription
queryMasterobjectQuery configuration object containing selectFields, fromClause, and other query parameters

Optional Parameters

ParameterTypeDescription
fileNamestringName of the CSV file to generate (default: "export.csv")
includeDateInFilenamestringWhether to include date in filename - "true" or "false" (default: "true")
includeHeaderstringWhether to include headers in CSV - "true" or "false" (default: "true")

[Image placeholder: Export function configuration panel]

Input Example

Basic Export

{
  "queryMaster": {
    "selectFields": [
      {
        "fieldName": "customer_name",
        "fieldAlias": "customerName",
        "fieldLabel": "Customer Name"
      },
      {
        "fieldName": "email",
        "fieldAlias": "email",
        "fieldLabel": "Email Address"
      },
      {
        "fieldName": "status",
        "fieldAlias": "status",
        "fieldLabel": "Status"
      }
    ],
    "fromClause": {
      "mobjectId": "customer-mobject-uuid"
    }
  },
  "fileName": "customers_export.csv"
}

Export with Date in Filename

{
  "queryMaster": {
    "selectFields": [
      {
        "fieldName": "order_number",
        "fieldAlias": "orderNumber",
        "fieldLabel": "Order Number"
      },
      {
        "fieldName": "total_amount",
        "fieldAlias": "totalAmount",
        "fieldLabel": "Total Amount"
      }
    ],
    "fromClause": {
      "mobjectId": "order-mobject-uuid"
    },
    "where": [
      {
        "field": "order_date",
        "operator": "greaterThanOrEquals",
        "value": "2024-01-01"
      }
    ]
  },
  "fileName": "orders_export.csv",
  "includeDateInFilename": "true",
  "includeHeader": "true"
}

Output Schema

FieldTypeDescription
fileIdstring (uuid)ID of the generated CSV file in the file storage system
fileNamestringName of the generated CSV file (includes date suffix if enabled)
rowCountintegerNumber of rows in the exported file

Output Example

{
  "fileId": "a7b9c4d2-3e5f-4a1b-9c8d-7e6f5a4b3c2d",
  "fileName": "customers_export_20240120_143022.csv",
  "rowCount": 150
}

[Image placeholder: Export output visualization]

Field Labels as Headers

The function automatically uses field labels from the QueryMaster as CSV headers. If a field has a fieldLabel, it will be used as the header; otherwise, the fieldAlias is used.

Example:

  • Field with label: fieldLabel: "Customer Name" → CSV header: "Customer Name"
  • Field without label: fieldAlias: "customerName" → CSV header: "customerName"

Picklist Resolution

Picklist values are automatically resolved to their display names in the exported CSV:

  • Source: status: "active-uuid"
  • Exported: Status: "Active"

Use Cases

Export Customer Data

Export customer records to CSV:

{
  "queryMaster": {
    "selectFields": [
      {"fieldName": "name", "fieldAlias": "name", "fieldLabel": "Name"},
      {"fieldName": "email", "fieldAlias": "email", "fieldLabel": "Email"},
      {"fieldName": "phone", "fieldAlias": "phone", "fieldLabel": "Phone"}
    ],
    "fromClause": {
      "mobjectId": "customer-mobject-uuid"
    }
  },
  "fileName": "customers.csv",
  "includeDateInFilename": "true"
}

Scheduled Data Export

Export data on a schedule and email the file:

Scheduled Trigger → Export → EmailNotification(attach CSV) → End

[Image placeholder: Export workflow examples]