Skip to content
Business productivity / Database

Microsoft Dynamics 365 and PostgreSQL integration — two-way sync

Keep supported Microsoft Dynamics 365 and PostgreSQL records aligned with two-way data sync. Give each team access to current data while controlling which system can update each field.

  • Field mappings and sync direction under your control
  • Inspect and resolve record errors in one dashboard
Two-way sync for supported objects
stacksync.com

Teams building with Stacksync

Why teams connect Microsoft Dynamics 365 and PostgreSQL

Put your Microsoft Dynamics 365 and PostgreSQL data to work

Start with the work your team needs to complete: keep records up to date, make operational data available for reporting, or move data to a new system. Choose one Microsoft Dynamics 365 and PostgreSQL workflow to test, define what success looks like, and decide who handles failed updates.

  • 01 Two-way sync of accounts and contacts with a Postgres or SQL database so engineers query SQL while sales works in Dynamics.
  • 02 Keep opportunities and orders consistent with the ERP or billing system without manual re-entry.
  • 03 Expose SaaS objects (CRM contacts, ERP invoices, support tickets) as Postgres tables that internal tools can query and join
  • 04 Let an application write to its own database and have those rows appear as records in business systems in near real time

What records can you sync?

Explore the record types and read/write requirements for each system.

Microsoft Dynamics 365Read and write support varies by recordStandard entities · Custom entities

Record types covered in the setup guide

Record typeCoverage and requirements
Standard entitiesRequires account access and compatible change tracking. Confirm field permissions and sync direction.
Custom entitiesRequires API exposure and compatible change tracking. Confirm field permissions and sync direction.

Read the Microsoft Dynamics 365 connector guide

PostgreSQLRead and write support varies by recordTables

Record types covered in the setup guide

Record typeCoverage and requirements
TablesSee connector requirements. Confirm field permissions and sync direction.

Read the PostgreSQL connector guide

Implementation guideConnection requirements, mapping worksheets, testing, and recovery.

Connection requirements and limits

Microsoft Dynamics 365

Integration interface
REST API (Dataverse Web API, OData v4); Finance & Operations apps expose a separate OData data-entity surface
Authentication
Microsoft OAuth sign-in: user provides the D365 environment URL, signs in with Microsoft credentials, and accepts the Stacksync app (permissions to read CRM data and interact with OData entities)
Change detection
Incremental sync uses Dynamics Change Tracking; custom entities need Track Changes enabled.
Read access
Available for supported records
Write access
Available for supported records

Limitations to check

  • Custom-entity change tracking must be enabled before incremental changes can be captured.
Technical documentation

Documentation reviewed 2026-09-15. Check the linked guides for current account and record requirements.

Microsoft Dynamics 365 setup guide

PostgreSQL

Integration interface
SQL wire protocol (PostgreSQL frontend/backend protocol)
Authentication
Database credentials (connection string or parameters), with optional SSL root certificate upload and optional SSH tunnel (SSH user + host); a least-privilege DB user
Change detection
The Postgres connector uses logical replication. The separate Postgres Heroku connector uses database triggers when replication rights are unavailable.
Read access
Available for supported records
Write access
Available for supported records

Limitations to check

  • Renaming a schema, table, or column requires updating the sync configuration.
  • Database views cannot be used as writable destinations in two-way sync; validate the selected connector and view support separately.
Technical documentation

Documentation reviewed 2026-09-15. Check the linked guides for current account and record requirements.

PostgreSQL setup guide

Design your implementation

Use the worksheets and reference checks to capture record identity, ownership, and the result your business expects.

Implementation reference

Record identity and field ownership

Keep each record tied to its source ID. Use the references below to choose field owners and preserve relationships between records.

Download the mapping worksheet

CSV · No email required · Record matching, ownership, and test cases

Reporting datasetAccounts Proposed company table in PostgreSQL (choose its name)

Plan a company dataset while preserving its source meaning.

Microsoft Dynamics 365
Object support to establish
PostgreSQL
Your database schema

Record identity

Retain the source company ID and the destination customer/company ID. Separate legal entities, subsidiaries, and business units; a shared name or web domain is insufficient.

Field ownership

Assign ownership separately for relationship details and finance-controlled billing details.

Fields to include

  • Source record ID
  • Legal or display name
  • Business-unit reference
  • Lifecycle status

References: Microsoft Dynamics 365: Accounts documentation

Reporting datasetContacts Proposed contact table in PostgreSQL (choose its name)

Plan a contact dataset while preserving its source meaning.

Microsoft Dynamics 365
Object support to establish
PostgreSQL
Your database schema

Record identity

Use a stable person/contact ID and an explicit cross-system lookup. Email can change and can be shared, so treat it as a matching clue rather than a universal key.

Field ownership

Keep consent and communication preferences under an agreed authority; a general contact update must not silently resubscribe someone.

Fields to include

  • Source person ID
  • Display name
  • Email address
  • Organization reference
  • Consent state

References: Microsoft Dynamics 365: Contacts documentation

Reporting datasetOpportunities Proposed deal or opportunity table in PostgreSQL (choose its name)

Plan a deal or opportunity dataset while preserving its source meaning.

Microsoft Dynamics 365
Object support to establish
PostgreSQL
Your database schema

Record identity

Keep the opportunity/deal ID separate from any later order or invoice ID.

Field ownership

The sales process owns qualification and stage changes; downstream financial records have their own state and approval rules.

Fields to include

  • Source deal ID
  • Stage
  • Amount and currency
  • Expected close date
  • Company reference

References: Microsoft Dynamics 365: Opportunities documentation

Reporting datasetLeads Proposed prospect or lead table in PostgreSQL (choose its name)

Plan a prospect or lead dataset while preserving its source meaning.

Microsoft Dynamics 365
Object support to establish
PostgreSQL
Your database schema

Record identity

Retain the lead ID and record its relationship to any converted contact or company.

Field ownership

Choose which system may qualify or convert the lead; do not infer identical lifecycle stages.

Fields to include

  • Source lead ID
  • Qualification status
  • Owner reference
  • Conversion reference

References: Microsoft Dynamics 365: Leads documentation

Reporting datasetProducts Proposed product or catalog item table in PostgreSQL (choose its name)

Plan a product or catalog item dataset while preserving its source meaning.

Microsoft Dynamics 365
Object support to establish
PostgreSQL
Your database schema

Record identity

Distinguish the product ID, variant ID, SKU, and price-list entry; they are not interchangeable keys.

Field ownership

Assign ownership for catalog content, price, and stock separately.

Fields to include

  • Source product ID
  • SKU or variant reference
  • Description
  • Unit of measure
  • Price-list reference

References: Microsoft Dynamics 365: Products documentation

Reporting datasetQuotes, Orders & Invoices Proposed customer invoice table in PostgreSQL (choose its name)

Plan a customer invoice dataset while preserving its source meaning.

Microsoft Dynamics 365
Object support to establish
PostgreSQL
Your database schema

Record identity

Retain the invoice ID, issuer/legal entity, and original order reference; invoice numbers alone may overlap.

Field ownership

The financial system owns posting and accounting treatment. A posted invoice may need a credit or adjustment process instead of an overwrite.

Fields to include

  • Source invoice ID
  • Customer or supplier reference
  • Line totals
  • Currency
  • Posting/payment status

References: Microsoft Dynamics 365: Quotes, Orders & Invoices documentation

Architecture decision

Choose how to connect your systems

Use Microsoft Dynamics 365 Accounts and PostgreSQL Proposed company table in PostgreSQL (choose its name) for the first pilot. Verify its identity and permitted direction, then add dependent records only when the acceptance checks pass.

Stacksync managed sync

Best fit
Two-way sync for supported objects. Choose the records, writable fields, and permissions for your workflow.
Operating responsibility
Fits ongoing record synchronization when the required operations are supported. Add workflow steps for approvals or business actions that go beyond copying fields.
Before you choose
Check record matching: Retain the source company ID and the destination customer/company ID. Separate legal entities, subsidiaries, and business units; a shared name or web domain is insufficient. Verify field coverage, deletion handling, and how changes are detected.

Native vendor integration

Best fit
A vendor-built integration may fit if it supports your Microsoft Dynamics 365 and PostgreSQL record types.
Operating responsibility
Can reduce setup for a supported workflow. You may need another method for records or business steps it does not cover.
Before you choose
First check whether either vendor offers this integration. If available, verify Accounts / Proposed company table in PostgreSQL (choose its name), update direction, account tier, and related-record handling.

Custom API or workflow

Best fit
Consider when Microsoft Dynamics 365 and PostgreSQL need a transformation, approval, or action outside a direct record sync.
Operating responsibility
Provides control over business steps; the team owns credentials, version changes, error queues, and reconciliation.
Before you choose
Verify endpoint permissions, pagination, quotas, duplicate detection, and failure recovery.

File or scheduled snapshot

Best fit
Consider for a one-time Microsoft Dynamics 365 / PostgreSQL migration or a reporting need with an explicit freshness window.
Operating responsibility
Can simplify a bounded transfer; later changes and deletion history require another extraction or a separately designed incremental process.
Before you choose
Record the extraction cutoff, source IDs, encoding, date/number formats, and reconciliation totals.

Workflow reference

From a business event to the right update

Open a workflow to see its trigger, record relationships, and expected result.

Company reporting workflow

Starting event: A change to the selected Accounts or Proposed company table in PostgreSQL (choose its name) record needs a defined result in the other system.

  1. Start with Microsoft Dynamics 365 Accounts and PostgreSQL Proposed company table in PostgreSQL (choose its name). Use the record-matching and field-ownership rules from your mapping worksheet.
  2. Resolve parent organizations, business units, and currency references before dependent transactions.
  3. Test a normal update and one failed or repeated update in the supported direction. Keep both record IDs with the test results.

Expected result: Use two organizations with similar names and one with multiple business units. Verify that an update reaches the intended entity only.

If it fails: Repair the cross-system ID relationship before retrying dependent records; do not merge companies solely to remove a sync error.

Contact reporting workflow

Starting event: A change to the selected Contacts or Proposed contact table in PostgreSQL (choose its name) record needs a defined result in the other system.

  1. Start with Microsoft Dynamics 365 Contacts and PostgreSQL Proposed contact table in PostgreSQL (choose its name). Use the record-matching and field-ownership rules from your mapping worksheet.
  2. Resolve the organization relationship and any owner or consent references required by the destination.
  3. Test a normal update and one failed or repeated update in the supported direction. Keep both record IDs with the test results.

Expected result: Test an email change, two records sharing an email, and a person associated with multiple organizations.

If it fails: Hold ambiguous matches for review and reconcile the person ID before retrying; preserve the consent decision already recorded by its owner.

Deal or opportunity reporting workflow

Starting event: A change to the selected Opportunities or Proposed deal or opportunity table in PostgreSQL (choose its name) record needs a defined result in the other system.

  1. Start with Microsoft Dynamics 365 Opportunities and PostgreSQL Proposed deal or opportunity table in PostgreSQL (choose its name). Use the record-matching and field-ownership rules from your mapping worksheet.
  2. Map the customer and sales pipeline before the opportunity; map stage values deliberately.
  3. Test a normal update and one failed or repeated update in the supported direction. Keep both record IDs with the test results.

Expected result: Test a reopened won deal, a stage with no destination equivalent, and an amount using a different currency.

If it fails: Suspend downstream creation for a rejected deal and review whether an order already exists before retrying.

Plan the customer lifecycle across Microsoft Dynamics 365 and PostgreSQL

Starting event: A customer-facing change in Microsoft Dynamics 365 needs operational context in PostgreSQL.

  1. Select the relevant Accounts or Contacts records and identify whether the downstream relationship is a person, a company, a deal, or a reporting row.
  2. Define which lifecycle transitions are informative and which should request a downstream action. Keep conversion and merge history connected to stable IDs.
  3. Choose a representative reopened deal, changed contact identity, or reassigned account to test the handoff before expanding.

Expected result: The relationship survives a lifecycle change without creating a duplicate customer or triggering an unintended business action.

If it fails: Inspect merge/conversion history and existing destination records before replaying a lifecycle transition.

Production readiness

Test the behavior your business depends on

Keep both record IDs with the expected and actual result. Reconcile the same filters and time window in each system.

Accounts / Proposed company table in PostgreSQL (choose its name)

Test case

Use two organizations with similar names and one with multiple business units. Verify that an update reaches the intended entity only.

Expected result

The expected company relationship is preserved with no duplicate action or unintended write.

Contacts / Proposed contact table in PostgreSQL (choose its name)

Test case

Test an email change, two records sharing an email, and a person associated with multiple organizations.

Expected result

The expected contact relationship is preserved with no duplicate action or unintended write.

Opportunities / Proposed deal or opportunity table in PostgreSQL (choose its name)

Test case

Test a reopened won deal, a stage with no destination equivalent, and an amount using a different currency.

Expected result

The expected deal or opportunity relationship is preserved with no duplicate action or unintended write.

Leads / Proposed prospect or lead table in PostgreSQL (choose its name)

Test case

Convert a test lead after the first load and verify that it does not create a duplicate person or orphan its activity.

Expected result

The expected prospect or lead relationship is preserved with no duplicate action or unintended write.

Direction and permissions

Test case

Check that each connected account can read and write the chosen objects. Exercise both directions with a test record before enabling production changes.

Expected result

Only an approved, supported direction and permitted fields are written.

Freshness and reconciliation

Test case

Measure source and destination times for the selected records under normal load and a burst. Reconcile IDs and values using the same filters and cutoff.

Expected result

The process meets its agreed freshness target and reconciliation has no unexplained differences.

Failure recovery

Find the cause. Restore the data flow.

Start with the failed record and the destination error, then inspect the source value, field requirements, and access.

Rejected or repeated company change

Investigate

Inspect Microsoft Dynamics 365 Accounts and PostgreSQL Proposed company table in PostgreSQL (choose its name), their IDs, and the destination error.

Next action

Repair the cross-system ID relationship before retrying dependent records; do not merge companies solely to remove a sync error.

Rejected or repeated contact change

Investigate

Inspect Microsoft Dynamics 365 Contacts and PostgreSQL Proposed contact table in PostgreSQL (choose its name), their IDs, and the destination error.

Next action

Hold ambiguous matches for review and reconcile the person ID before retrying; preserve the consent decision already recorded by its owner.

Rejected or repeated deal or opportunity change

Investigate

Inspect Microsoft Dynamics 365 Opportunities and PostgreSQL Proposed deal or opportunity table in PostgreSQL (choose its name), their IDs, and the destination error.

Next action

Suspend downstream creation for a rejected deal and review whether an order already exists before retrying.

A record type or update is unavailable

Investigate

Check the Microsoft Dynamics 365 and PostgreSQL connector guides, account permissions, and any operations marked On Request.

Next action

Ask the integration team to confirm a supported way to handle that record. Verify whether it needs connector configuration or a separate workflow step.

Source and destination disagree after a retry

Investigate

Compare current source values, destination validation, identity mappings, and any side effects already completed.

Next action

Stacksync issue retry reads the current source state. Decide the intended state before retrying or reverting; reconcile downstream effects separately.

Read the Stacksync issues dashboard guide for retry and revert behavior.

How updates move between Microsoft Dynamics 365 and PostgreSQL

See how each system detects changes and which updates the other system can receive. Each direction has its own permissions and record requirements.

Microsoft Dynamics 365 PostgreSQL Timing depends on the connected systems

Detect changesIncremental sync uses Dynamics Change Tracking; custom entities need Track Changes enabled.

Apply updatesSelected writable fields update in PostgreSQL. Its permissions and validation rules still apply; rejected records can be inspected in the Issues dashboard.

PostgreSQL Microsoft Dynamics 365 Timing depends on the connected systems

Detect changesThe Postgres connector uses logical replication. The separate Postgres Heroku connector uses database triggers when replication rights are unavailable.

Apply updatesSelected writable fields update in Microsoft Dynamics 365. Its permissions and validation rules still apply; rejected records can be inspected in the Issues dashboard.

Update timing and record limits

  • Measure initial-load and ongoing-change latency separately. Source detection, selected objects, account limits, and destination validation determine the observed delay.
  • Custom-entity change tracking must be enabled before incremental changes can be captured.

Prepare Microsoft Dynamics 365 and PostgreSQL access

Set up both accounts before testing the mapping. Use test records where available, and identify the account administrator who can approve access and help resolve setup errors.

Microsoft Dynamics 365 setup checklist

  • Provide the Dynamics CRM environment URL and authorize the Stacksync app with Microsoft sign-in.
  • For custom entities, enable Track Changes in Power Apps/Dataverse before validating incremental updates.

Setup guides: Authorize Dynamics 365 CRM

PostgreSQL setup checklist

  • Use a single-column primary key with a database-generated default for every selected table; composite primary keys are not supported.
  • Give the connected database role the required ownership and replication rights. Logical replication requires wal_level=logical; check the hosted database procedure before changing it.
  • For PostgreSQL 12 and earlier, have the database administrator install the pgcrypto extension before starting the sync so tracking tables can use gen_random_uuid(). PostgreSQL 13 and later provide this function without the extension.

Setup guides: Authorize PostgresEnsuring Secure Cloud SQL Connections with SSL CertificateEnsuring Secure RDS Connections with SSL Certificate

Prepare to go live

Record the fields each system can update, the first-load cutoff, both record IDs, the expected update delay, and who handles errors. Complete the tests before production before expanding to more records.

Use the Microsoft Dynamics 365 and PostgreSQL planning worksheet to capture these decisions. Record the access owner in the worksheet and enter credentials only in the connection setup.

See Stacksync in action · Review current pricing

Security and control for your integrations

Use SSO and SCIM to manage access, secure connection options to reach your systems, and record-level retry and revert controls to resolve sync errors.

Explore security controls
FAQ

Microsoft Dynamics 365 and PostgreSQL integration FAQ

See your workflow in Stacksync

Walk through your Microsoft Dynamics 365 and PostgreSQL records, field mappings, and requirements with an integration engineer.