Office hours: Build your self-driving GTM engine·Oct 29, 9:00am PT, onlineRegister→
Cargo
  • PrimitivesData ModelsYour companies, contacts and deals, merged from every sourceContextWhat your team knows, as files every agent readsTerritoriesWho sells where, defined onceMailboxesMailboxes in your reps' names, warmed up and kept under limitsToolsThe actions your agents, plays and reps callAgentsAI that researches, decides and writes, reading your contextPlaysWorkflows that run on a trigger or a schedule, with retriesAppsInternal apps for your reps, hosted on Cargo
    Add-onsChrome ExtensionSell faster, right in your browserButtonTrigger AI agents inside your CRMFormTurn any tool into an embeddable formSlackTag Cargo in Slack. It does the GTM workGitHubPlan on every pull request, deploy on merge
    MoreProjectsDefine your entire GTM in codeCLIUse Cargo from your terminalMCPUse Cargo from Claude and ChatGPTDeveloper resourcesCargo API docs, OpenAPI spec, auth docs, webhooks, MCP serverAPI ReferenceExplore the Cargo APIDocumentationLearn how to use CargoIntegrationsConnected to your entire GTM stack
  • VeriffHow Veriff replaced MuleSoft with Cargo under NetSuite, Stripe and SalesforceAugmentHow Augment Code routes developer sign-ups to reps in under an hourWeights & BiasesHow Weights & Biases ships a new purchase signal in 2 days on CargoSee all
  • Pricing
  • Cookbooks
  • Blog
Sign in
Blog

How to Retire Hundreds of Brittle Salesforce and Marketo Workflows

5 Dec 20267min read
AurelienAurelien

You don’t replace hundreds of brittle Salesforce and Marketo workflows with a different set of workflows. You sort them into three bins: logic that must stay native because it runs inside the save (keep it in Salesforce Flow), automations nobody needs (delete them), and business decisions copied into dozens of places (pull them into one rule set that a few execution workflows read). The third bin is where the breakage comes from: a few distinct rules hiding behind most of the automations.

Why they break #

Each automation hard-codes a decision. “Enterprise means 1,000+ employees” ends up in an assignment flow, a Marketo scoring campaign, a lead-status flow and an SDR alert. The definition changes, someone edits three of the four, and the fourth disagrees for a year.

The second failure is more than one writer per field. In Salesforce, before-save flows, Apex triggers and after-save flows all run on the same save, and when two of them set OwnerId or Lead_Status__c the later one wins. Add a Marketo campaign that writes the same field through the sync, and the value on the record depends on timing.

The deadline is also real: Salesforce ended support for Workflow Rules and Process Builder on December 31, 2025. They still run, but bugs are no longer fixed, and the Migrate to Flow tool skips some cases (cross-object criteria in workflow rules, and processes that are not record-triggered), which have to be rebuilt by hand.

Step 1: build the field write map #

The inventory that matters is not a list of automations. It is a list of fields, and every automation that writes each one.

  • Salesforce: for each object, list active record-triggered flows, workflow rules, processes and Apex triggers, and note which fields each one sets.
  • Marketo: list active smart campaigns whose flow steps include Change Data Value or Change Score, and which fields they touch.
  • Everything else: enrichment tools, routing tools and integrations that write back to the CRM through their own sync user.

Then sort the map by writer count. An illustrative org looks like this:

FieldWritersWhat it means
Lead.OwnerId6 (2 flows, 1 assignment rule, 1 Apex trigger, 1 Marketo campaign, 1 routing tool)Ownership depends on which ran last
Lead.Lead_Status__c4Status regressions on re-sync
Account.Segment__c3 (each with its own employee threshold)Three definitions of enterprise
Lead.LeadSource2 (form handler, enrichment sync)First-touch attribution overwritten

Every row with more than one writer is a bug waiting to be filed. Fix these first.

Step 2: sort every automation into a bin #

Use one rule per automation:

  1. Keep in Salesforce Flow if a user expects it the moment they click Save, or if it must block bad data: validation, required defaults, field formatting, before-save calculations on the same record. Moving these out adds latency and a failure mode for no gain.
  2. Delete if it has not fired in months, duplicates another automation, or serves a process that no longer exists. Deactivate first, wait a full sales cycle, then delete.
  3. Consolidate if it encodes a business decision (segment, fit, readiness, owner, routing, lifecycle stage) or reads data that lives outside the CRM (product usage, the warehouse, enrichment). These are the automations that multiply.

Marketo sorts the same way: programs, nurtures and anything that sends stay in Marketo; normalization and scoring campaigns usually go in the third bin, because the score is a decision sales also needs.

Step 3: one decision, a few writers #

The consolidated design has two properties: each business definition exists once, and each field has exactly one writer.

Here is the segment rule from the table above, written once in a Cargo project. A play re-runs it whenever an account in the unified model changes, and it is the only thing allowed to write Segment__c:

typescript
import { definePlay, defineWorkflow, connectorRef } from "@cargo-ai/cdk";
import { z } from "zod";
import { accounts } from "../models/accounts";

const segmentAccount = defineWorkflow(
  "segment-account",
  {
    input: z.object({ salesforce_id: z.string(), employees: z.number() }),
    output: z.object({ written: z.boolean() }),
    uses: { salesforce: connectorRef("9c26…", "salesforce") },
  },
  ({ input, uses }) => {
    if (input.employees >= 1000) {
      uses.salesforce.updateRecords({
        objectType: "Account",
        matchingValue: input.salesforce_id,
        matchingPropertyName: "Id",
        mappings: [{ propertyName: "Segment__c", value: "Enterprise" }],
      });
    } else {
      uses.salesforce.updateRecords({
        objectType: "Account",
        matchingValue: input.salesforce_id,
        matchingPropertyName: "Id",
        mappings: [{ propertyName: "Segment__c", value: "Commercial" }],
      });
    }
    return { written: true };
  },
);

export const segmentAccounts = definePlay("segment-accounts", {
  model: accounts,
  workflow: segmentAccount,
  changeKinds: ["added", "updated"],
  runCreationRule: "always",
  schedule: { type: "realtime" },
});

Changing the threshold is now a one-line pull request: cargo-ai project plan shows the change and merging deploys it. Deactivate the three old writers of Segment__c in the same release, and have routing, scoring and alerts read the segment instead of recomputing it.

Two habits keep this from regressing:

  • One integration user per writer. Give the consolidated layer its own Salesforce user, so the field history shows exactly which system set a value. Use field-level security to make the fields it must never touch (first-touch LeadSource, for example) read-only for that user. A field the integration cannot edit cannot be overwritten by a bug.
  • Migrate field by field, not flow by flow. Move one field’s decision, deactivate its old writers, watch a week of runs, then move the next. A big-bang cutover makes it impossible to tell which change caused a regression.

When not to do this #

If you have 30 automations, one CRM and no data outside it, Flow plus Marketo is enough; clean up the duplicate writers and stop there. The consolidation pays off when decisions span systems (warehouse, product usage, enrichment, several sales tools) or when the same definition is copied into many places. It also needs an owner: someone, or a coding agent under review, who reads and changes the rule set. Without one, you have moved the mess, not removed it.

Frequently asked questions #

Salesforce Flow for logic that must run inside the save, and a GTM orchestration layer for business decisions that span systems, such as segment, fit, owner and routing. The point is fewer writers per field, not a different place to store the same sprawl.

No. Salesforce ended support on December 31, 2025, which means no bug fixes or customer support for them. Active rules and processes keep running, and Salesforce recommends migrating them to Flow.

Sources #

  • Salesforce: Workflow Rules and Process Builder end of support, Migrate to Flow tool, Migrate to Flow considerations.
  • Cargo: plays, workflows in code, Salesforce connector, plan and deploy.
~/run-it-on-cargo/

Build this workflow instead of reading about it.

Cargo is the GTM infrastructure your coding agent builds on: enrichment, scoring, routing and outreach, defined in code and run in production.

Start building
AurelienAurelienDec 5, 2026
On this page
  • Why they break
  • Step 1: build the field write map
  • Step 2: sort every automation into a bin
  • Step 3: one decision, a few writers
  • When not to do this
  • Frequently asked questions
  • Sources

Stay Informed with our
weekly Newsletter

Related articlesSee all articles
RevOps
CRM-Safe Automation: Protected Fields and Record-Level Observability

How RevOps keeps automation from corrupting the CRM: matching that refuses to guess, a write policy for every field (including attribution fields that must never be overwritten), and a record-level trace that answers why a record was skipped, routed or updated.

AurelienAurelien·Dec 5, 2026
AI & Automation
How AI Agents Use Account History, ICP Rules and Playbooks Across Runs

An agent that runs every night forgets everything between runs unless you decide where each kind of state lives. Account history belongs on the record, ICP rules and playbooks in a versioned repository, cooldowns and caps in an expiring key-value store, and only soft facts in agent memory. A worked Cargo workflow that does all four.

AurelienAurelien·Dec 5, 2026
AI & Automation
Best AI Tools That Work With Your CRM (Salesforce and HubSpot) in 2026

Six AI sales tools that read and write Salesforce or HubSpot data, compared on what they can change in the CRM, how you review it, and what they cost, with prices checked on each vendor's page on December 5, 2026.

AurelienAurelien·Dec 5, 2026

Build the self-driving GTM engine

Your coding agents build it on Cargo.Or our team builds, operates and improves it with you.

Start building
Cargo
Backed byY CombinatorSOC 2 Type IICertified
LinkedinX

Product

Data ModelsContextTerritoriesMailboxesToolsAI AgentsPlaysAppsIntegrationsPricing

Add-ons

Chrome extensionButtonFormSlackGitHub

Build

DocsDeveloper resourcesCargo API docsCargo OpenAPI specCargo auth docsCargo webhooksCargo MCP serverProjectsClaude CodeCodexCursorAll coding agents

Resources

ReportsBlogCustomer storiesCookbooksEnrichmentRoutingSignalsScoringCRM hygieneAd audiencesGTM skillsGTM EngineeringGlossaryCompareCargo x ClayCargo x WorkatoCargo x n8nCargo x DeeplineCargo x DefaultCargo x LeanDataCargo x UnifyCargo x ValleyCargo x GojiberryCargo x PhantomBusterCargo x ZapierCargo x ApolloCargo x Chili PiperCargo x Common RoomCargo x MakeCargo x Tray.io

Company

ManifestoCommunityEventsJobsPartners DirectoryPartner Program

Legal

SecurityTerms of servicePrivacy PolicyRefundsDPASupport
© 2026 Cargo
 ////////    ///////    ////////     ////////    ///////
///         ///   ///   ///   ///   ///         ///   ///
///         ///   ///   ///   ///   ///         ///   ///
///         /////////   ////////    ///  ////   ///   ///
///         ///   ///   /// ///     ///   ///   ///   ///
///         ///   ///   ///  ///    ///   ///   ///   ///
 ////////   ///   ///   ///   ///    ///////     ///////

$ npm install -g @cargo-ai/cli