Pipedrive to ERP Order Sync on Won
When a Pipedrive deal is won, the flow creates the corresponding sales order in the ERP/finance system (Dataverse, QuickBooks, or Xero) with the deal's products and pricing, links the records, and notifies finance. Keeps sales and finance in lockstep without re-entering won deals.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
When a Pipedrive deal is won, this flow creates the corresponding sales order in the ERP / finance system (Dataverse) from the deal's value, currency, customer and owner, cross-links the order back into Pipedrive, and emails finance. It keeps sales and finance in lockstep without re-keying won deals.
Status: Built — solution FlowLibs - Pipedrive to ERP Order Sync on Won, flow ships Off (demo). Going live requires only: authorize the three connections, set the env var values, and turn the flow On.
Build note (connector reality): The Pipedrive connector has no native "deal won" trigger and no ListDealProducts / UpdateDeal operations. So a Recurrence poll + status filter replaces the won-trigger, the order is built from the deal header (value/currency/customer/owner) instead of per-line products, and the cross-link back to Pipedrive uses AddActivity (a follow-up task on the deal) instead of UpdateDeal. This keeps the flow 100% connector-first with no HTTP fallbacks and no inline credentials.
Use Case
A sales + finance team wants every won deal to automatically produce a finance order, deduplicated and cross-linked, so finance is notified the moment a deal closes and nobody re-enters orders by hand.
Flow Architecture
Recurrence Poll For Won Deals
Recurrence (Hourly)Scheduled poll (Pipedrive has no won-trigger).
Initialize configuration
Initialize Variable x4Order target (dataverse/quickbooks/xero), order table entity set, finance email, and a correlation id (guid) for end-to-end traceability — sourced from env vars.
List and filter won deals
Pipedrive ListDeals + Filter (status = won)Retrieves all deals and keeps only those where status = 'won'.
Per won-deal dedup
Apply to each Won Deal (concurrency 1) → Dataverse ListRecordsLooks up any existing order with this deal id; the condition proceeds only when none is found.
Create order, cross-link, notify
Dataverse CreateRecord + Pipedrive AddActivity + Outlook SendEmailV2Creates the ERP sales order in flowlibs_salesorder, adds a follow-up task on the deal referencing the order, and emails finance an HTML order summary.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_OrderTarget | String | dataverse | Target finance system (dataverse / quickbooks / xero). |
| flowlibs_OrderTable | String | flowlibs_salesorders | Dataverse entity set of the order table. |
| flowlibs_FinanceEmail | String | finance@contoso.com | New-order notice recipient. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Pipedrive | shared_pipedrive | ListDeals AddActivity |
| Microsoft Dataverse | shared_commondataserviceforapps | ListRecords CreateRecord |
| Office 365 Outlook | shared_office365 | SendEmailV2 |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- QuickBooks / Xero target
- Swap the Create ERP Sales Order Dataverse step for the QuickBooks/Xero connector's create-order action; branch on varOrderTarget to support multiple targets.
- Line-item products
- The Pipedrive connector exposes no deal-products operation. To carry per-line products/pricing, add a built-in HTTP call to GET /v1/deals/{id}/products (bind the API token to a new flowlibs_ env var) and loop the lines into ERP order lines.
- Tax / discount
- Extend the order table with tax-code and discount columns and map them through.
- Trigger latency
- Tighten the Recurrence interval (e.g. every 15 minutes) for near-real-time sync; the dedup ledger keeps it safe at any frequency.
- Cross-link richness
- AddActivity records the order id on the deal; switch to a Pipedrive note or a custom deal field (via REST) if a non-task cross-link is preferred.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Won filter (from)
Source array for the won filter.
EXPR.02Won filter (where)
Keeps only won deals.
EXPR.03Dedup $filter
OData filter on the deal id dedup key.
EXPR.04Not-yet-synced gate
True only when no order exists yet.
EXPR.05Customer (org → person fallback)
Resolves the customer name.
Customize & download
Generate a ready-to-import copy of this solution with your environment-variable values baked in — available on Base, Pro, or Team.
Upgrade to customize
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.