How to Retire Hundreds of Brittle Salesforce and Marketo Workflows
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:
| Field | Writers | What it means |
|---|---|---|
Lead.OwnerId | 6 (2 flows, 1 assignment rule, 1 Apex trigger, 1 Marketo campaign, 1 routing tool) | Ownership depends on which ran last |
Lead.Lead_Status__c | 4 | Status regressions on re-sync |
Account.Segment__c | 3 (each with its own employee threshold) | Three definitions of enterprise |
Lead.LeadSource | 2 (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:
- 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.
- 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.
- 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:
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 #
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.