Training Day
Simple Ledger Scripts

Get Changed Records

Retrieves records from QuickBooks Online that have been modified since a specified timestamp, supporting pagination for large data sets.

Introduction

The "Get Changed Records" script facilitates the retrieval of records from QuickBooks Online (QBO) that have been modified since a specified timestamp. This script is particularly useful for synchronization processes where you need to fetch only records that have changed since your last sync operation.

The script handles query construction, filtering by modification timestamp, sorting, and pagination to make it easier to retrieve incremental changes from QBO efficiently.

Key Features

  • Change Tracking: Filters records by their last modification timestamp
  • Pagination Support: Allows fetching records in manageable batches
  • Sorting Control: Orders results by modification timestamp for predictable sync sequences
  • QBO Query Construction: Builds and executes proper QBO query syntax automatically

Usage

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

Perform Script [ "Get Changed Records ( entity, modStamp, startPosition )" ; JSONObject ]

Script Parameter

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

PropertyTypeDescription
entitystringThe QuickBooks Online entity to query (e.g., "Customer", "Invoice")
lastModStampstring(Optional) The timestamp to filter records modified after this time
startPositionnumber(Optional) The starting position for pagination
maxResultsnumber(Optional) The maximum number of results to return in a single request

Return Value

On success, the script returns a JSON object with the following structure:

PropertyTypeDescription
noMoreRecordsbooleanIndicates if there are more records to fetch
qboQueryTimestampstringThe time on QBO's servers when this query was executed
recordsarrayThe array of records retrieved from QuickBooks Online

Error Handling

If an error occurs during execution, the script returns an error object with:

PropertyTypeDescription
codenumberError code
messagestringA description of the error

Implementation Details

The script follows this process flow:

  1. Parameter Extraction: Parses the input parameters from the script parameter
  2. Query Construction: Builds a QBO query with appropriate filtering and pagination
  3. API Request: Uses the "Send QBO HTTP Request" script to execute the query
  4. Response Processing: Extracts the relevant records and pagination information
  5. Result Formatting: Structures the result in a consistent format for the calling script

Dependencies

This script depends on:

  • The "Send QBO HTTP Request" script for making the actual API call
  • Proper QBO entity names matching those in the QuickBooks Online API

On this page