Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Node.js Behavior in Heroku
      • Troubleshooting Node.js Apps
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Model Context Protocol
    • Vector Database
    • Heroku Inference
      • Inference Essentials
      • AI Models
      • Inference API
      • Quick Start Guides
    • Working with AI
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Heroku Enterprise
  • Heroku Connect (Salesforce sync)
  • Heroku Connect Reference
  • The Heroku Connect Trigger Log

The Heroku Connect Trigger Log

English — 日本語に切り替える

Last updated December 08, 2022

Table of Contents

  • Overview
  • Access the Trigger Log
  • Trigger Log Retention
  • Table Structure
  • States
  • Troubleshooting With the Trigger Log

The trigger log captures changes made to records in Heroku Postgres. Heroku Connect uses the trigger log to send data to Salesforce. This article helps you understand how it works and how to read it.

Overview

Two tables in the schema configured for your Heroku Connect add-on house the trigger log. Connect captures new changes in the _trigger_log table. Processed records move from the _trigger_log table to the _trigger_log_archive.

Heroku Connect processes all read-write captured changes to send to Salesforce in a single process per add-on. Each trigger log entry has a state that indicates if Heroku Connect has processed it. While the trigger log also captures changes for read-only mappings, Heroku Connect takes no actions on these changes.

Changing a mapping from read-write to read-only doesn’t prevent the sending of already captured changes to Salesforce.

Captured Changes

When an INSERT occurs on a mapped read-write table, all the columns are captured. After a successful INSERT into Salesforce, Connect captures the sfid of the newly created record and writes that back to the originating table in Postgres.

When an UPDATE occurs on a mapped read-write table, the trigger compares the values in the row before and after the change. It records only the changed values.

A DELETE operation records just the delete.

If a TRUNCATE operation occurs on a mapped read-write table, the records don’t get deleted in Salesforce. Triggers on mapped tables only apply to INSERT, UPDATE, and DELETE operations. TRUNCATE operations don’t get captured in the _trigger_log table. Delete the records in Salesforce separately yourself.

Connect isn’t able to observe change within transactional bounds and can’t enforce a strict ordering of writes as they occurred in the DB.

Access the Trigger Log

You can view the _trigger_log table of your database by using heroku pg:psql:

SELECT table_name, record_id, action, sf_message
    FROM salesforce._trigger_log;

Trigger Log Retention

Demo Heroku Connect add-on plans keep changes in the _trigger_log_archive table for 7 days, while paid add-ons keep changes in the archive for 30 days. Connect automatically purges changes older than 30 days.

Table Structure

Both _trigger_log and _trigger_log_archive tables have the same structure.

Column Type Purpose
id integer Table Primary Key. Also used to determine order of changes.
created_at timestamp Time change captured.
updated_at timestamp Changed when entry is modified by Heroku Connect.
processed_at timestamp Time when Heroku Connect finished working on the entry.
table_name varchar(128) Table the change was captured from.
record_id integer id of the record for the captured change.
sfid varchar(18) Salesforce ID of the captured change (if applicable).
action varchar(7) The operation captured: INSERT, UPDATE, or DELETE.
state varchar(8) The current state of the record (see States).
values text hstore encoded column values captured for the change.
sf_message text Any error messages returned from Salesforce when an error occurs during writing. (See Heroku Connect Write Errors).
old text The old value captured from before the change encoded in hstore format.

States

The trigger log tracks the state of each entry in the state field. The end state of each entry can be: SUCCESS, MERGED, IGNORED, FAILED or READONLY. Additionally, the entry can go through the states NEW, PENDING, IGNORE and BULKSENT

State Description
SUCCESS The row was successfully written to Salesforce.
MERGED This only applies to the Merged Writes algorithm. Several changes were made to a single row within a single polling interval. Connect merges all of the changes into a single API request to Salesforce.
IGNORED Connect didn’t attempt to write the record to Salesforce. This state can happen if you update a record, but don’t actually change any data that syncs back to Salesforce (unmapped fields).
FAILED Connect tried to write the record, but failed. The sf_message column contains an explanation.
READONLY A captured change from a read-only table. Connect takes no action on these changes.
NEW A newly captured change ready for processing.
IGNORE A newly captured change that syncs back to Salesforce (unmapped fields).
PENDING Connect is processing this change.
BULKSENT Bulk write is in progress, but not completed yet.

Troubleshooting With the Trigger Log

The trigger log is useful for troubleshooting write errors. See Heroku Connect Write Errors for more info.

Keep reading

  • Heroku Connect Reference

Feedback

Log in to submit feedback.

Using Custom Triggers with Heroku Connect Using Custom Triggers with Heroku Connect

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices