Training Day
Simple Ledger Scripts

Send Data To QBO

Creates or updates records in QuickBooks Online by sending structured data for a specified entity type, handling request formatting and error processing.

Introduction

The "Send Data To QBO" script provides a simplified interface for creating or updating records in QuickBooks Online (QBO). This script handles the complexity of sending data to QBO by constructing the appropriate API request, managing authentication, and processing the response.

This script is essential for integration workflows that need to push data from FileMaker to QuickBooks Online, such as creating new customers, invoices, or updating existing records.

Key Features

  • Entity Type Flexibility: Works with any QBO entity type (Customer, Invoice, etc.)
  • Structured Data Support: Accepts properly formatted JSON data for the specific entity type
  • Standardized API Interaction: Handles all HTTP request formatting and authorization
  • Consistent Error Handling: Provides clear error information if the API call fails
  • Clean Response Format: Returns just the created/updated record data from QBO

Usage

To use this script, call it using the FileMaker "Perform Script" step:

Perform Script [ "Send Data To QBO (entity; record  )" ; JSONObject ]

Script Parameter

The script accepts a single JSON object parameter with the following properties:

PropertyTypeDescription
entitystringThe QuickBooks Online entity type (e.g., "Customer", "Invoice")
recordobjectThe structured data in the correct format for the specified entity type

Return Value

On success, the script returns the created or updated record as a JSON object, including any additional fields that QBO may have added (such as IDs or timestamps).

Error Handling

If an error occurs, the script returns an error object with the following structure:

PropertyTypeDescription
codenumberError code
messagestringA description of the error

Implementation Details

The script follows this process flow:

  1. Parameter Validation: Verifies that required parameters are present
  2. Request Construction: Builds the API request with the appropriate path and data
  3. API Request: Uses the "Send QBO HTTP Request" script to send the data to QBO
  4. Response Processing: Extracts the returned entity data from the response
  5. Result Formatting: Returns the entity data to the calling script

Dependencies

This script depends on:

  • The "Send QBO HTTP Request" script for making the actual API call
  • Proper formatting of the record data according to QBO API specifications for each entity type

Example

Here's an example of creating a new customer in QBO:

Set Variable [ $newCustomer ; Value: JSONSetElement ( "{}";
  ["DisplayName"; "ABC Company"; JSONString];
  ["CompanyName"; "ABC Company, Inc."; JSONString];
  ["PrimaryEmailAddr"; JSONSetElement("{}"; "Address"; "contact@abccompany.com"; JSONString); JSONObject]
)]

Perform Script [ "Send Data To QBO (entity; record  )" ;
  JSONSetElement("{}";
    ["entity"; "Customer"; JSONString];
    ["record"; $newCustomer; JSONObject]
  )
]

On this page