Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
clientell-ai avatar

Sf Flow

  • 42 installs
  • 12 repo stars
  • Updated July 14, 2026
  • clientell-ai/salesforce-skills

sf-flow is an agent skill that supplies Salesforce Flow metadata XML examples for elements like Assignment and collection updates.

About

sf-flow is a reference agent skill for Salesforce Flow development expressed as valid Flow metadata XML. It documents elements such as Assignment with operators (Assign, Add), assignment from record fields via elementReference, and patterns for adding items to collections, each with connector hooks to the next element. Solo builders and small teams extending Salesforce for CRM, RevOps, or custom SaaS on the platform can invoke this skill when their agent must generate or review flow XML instead of hand-waving Admin UI clicks. The readme is structured as a technical cookbook rather than a business methodology, so it pairs best with an org where you deploy flows as metadata in source control.

  • Complete Flow elements reference in metadata XML format
  • Assignment element examples: Assign, Add, elementReference from records
  • Collection addition patterns for flow variables
  • Connector targetReference wiring between elements
  • Copy-paste XML aligned with Salesforce Flow metadata conventions

Sf Flow by the numbers

  • 42 all-time installs (skills.sh)
  • Ranked #3,272 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/clientell-ai/salesforce-skills --skill sf-flow

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs42
repo stars12
Security audit3 / 3 scanners passed
Last updatedJuly 14, 2026
Repositoryclientell-ai/salesforce-skills

What it does

Author valid Salesforce Flow metadata XML—including Assignment and collection patterns—while building automations on the platform.

Who is it for?

Best when you're shipping Salesforce automations and manage flows in XML or CI-deployed metadata.

Skip if: Non-Salesforce stacks, or admins who only use Flow Builder UI with no metadata/XML workflow.

When should I use this skill?

You are building or editing Salesforce Flows and need valid metadata XML for Assignment and related elements.

What you get

You get correct, connector-linked Flow XML snippets your agent can embed in Salesforce metadata projects or reviews.

  • Flow XML fragments for assignments and collections
  • Connector-linked element blocks ready for metadata merge

Files

SKILL.mdMarkdownGitHub ↗

Flow Generator & Process Builder Migrator

You are a Salesforce Flow specialist. Generate valid .flow-meta.xml files and migrate Process Builders to optimized Flows.

Flow Best Practices

Architecture Rules

  • Maximum 3 record-triggered flows per object (before-save, after-save, before-delete)
  • Use a Custom Permission bypass mechanism for all record-triggered flows
  • Consolidate Process Builder logic — do NOT create 1:1 naive conversions
  • Use subflows for reusable logic
  • Use fault connectors on all DML and callout elements

Bypass Pattern

Every record-triggered flow should start with a Decision element checking:

<decisions>
    <name>Check_Bypass</name>
    <label>Check Bypass</label>
    <defaultConnector>
        <targetReference>Main_Logic</targetReference>
    </defaultConnector>
    <defaultConnectorLabel>Continue</defaultConnectorLabel>
    <rules>
        <name>Is_Bypassed</name>
        <conditionLogic>or</conditionLogic>
        <conditions>
            <leftValueReference>$Permission.Bypass_Automation</leftValueReference>
            <operator>EqualTo</operator>
            <rightValue>
                <booleanValue>true</booleanValue>
            </rightValue>
        </conditions>
        <label>Bypassed</label>
    </rules>
</decisions>

Flow Types

1. Record-Triggered Flow (replaces Process Builder + Workflow Rules)

  • before save — field updates (no DML needed, most efficient)
  • after save — related record updates, callouts, platform events
  • before delete — validation, cascade operations

2. Screen Flow — user-facing wizards, guided processes 3. Autolaunched Flow — invoked by Apex, other flows, or platform events 4. Scheduled Flow — time-based batch operations

Flow XML Structure

<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>62.0</apiVersion>
    <label>Account Before Save</label>
    <processType>AutoLaunchedFlow</processType>
    <triggerType>RecordBeforeSave</triggerType>
    <objectType>Account</objectType>
    <triggerOrder>1</triggerOrder>
    <status>Active</status>
    <!-- Elements go here -->
</Flow>

Process Builder Migration

Migration Steps

1. Inventory: Read the Process Builder metadata from force-app/main/default/flows/ 2. Analyze: Identify all criteria nodes and actions 3. Consolidate: Group related PBs on same object into single flow 4. Generate: Create optimized Flow XML with:

  • Bypass decision at entry
  • Consolidated criteria as Decision elements
  • Field updates as Assignment elements (before-save) or Record Update elements (after-save)
  • Related record updates as Get + Update elements

5. Dependencies: Deploy Custom Permission and Custom Metadata first 6. Deploy: sf project deploy start -d force-app/main/default/flows/ 7. Verify: Confirm flow is active and PB is deactivated

Common PB → Flow Translations

Process BuilderFlow Equivalent
Criteria NodeDecision Element
Field Update (same record)Before-Save Assignment
Field Update (related record)After-Save Get Records + Update Records
Create RecordAfter-Save Create Records
Email AlertAfter-Save Action (Email Alert)
Post to ChatterAfter-Save Create Records (FeedItem)
Invoke ApexAfter-Save Action (Apex)
Scheduled ActionScheduled Path on After-Save Flow

Error Handling

  • Add Fault connectors to every DML and callout element
  • Fault paths should create a log record or send admin notification
  • Use $Flow.FaultMessage and $Flow.InterviewGuid in error logs

Complete Flow Types

1. Record-Triggered — before save, after save, before delete 2. Screen Flow — user-facing wizards with screens, inputs, choices 3. Autolaunched — invoked by Apex, other flows, or REST API 4. Scheduled — time-based batch (up to 250K interviews/day) 5. Platform Event-Triggered — subscribes to Platform Events 6. Orchestration — multi-step approval/business processes with stages

Global Variables

VariableDescriptionExample
$RecordTriggering record (all fields){!$Record.Name}
$Record__PriorPrevious field values{!$Record__Prior.Status__c}
$ApiSession/server info{!$Api.Session_ID}
$OrganizationOrg info{!$Organization.Name}
$ProfileCurrent user's profile{!$Profile.Name}
$UserCurrent user fields{!$User.Email}
$FlowRuntime info{!$Flow.FaultMessage}
$PermissionCustom permission check{!$Permission.Bypass_Automation}
$LabelCustom labels{!$Label.Error_Message}
$SetupCustom Metadata{!$Setup.Config__mdt.Value__c}

Screen Flow Elements

  • Choice sets: Static choices, dynamic choices from SOQL, picklist choices
  • Conditional visibility: Show/hide components based on conditions
  • Stages: Multi-step progress indicator for guided flows
  • Validation: Per-component and per-screen validation formulas

Collection Operations

  • Loop: Iterate over collections with a loop variable
  • Add to collection: Assignment element with Add operator
  • Filter: Decision element inside loop to build filtered collections

Scheduled Paths

Replace Workflow time-based actions: add scheduled paths to after-save flows with time offsets (hours, days) relative to record field values.

Flow Test Coverage

  • Flows now have test coverage tracking (FlowTestCoverage object)
  • Create flow tests that exercise all decision branches
  • Check coverage with: SELECT FlowVersionId, NumElementsCovered, NumElementsNotCovered FROM FlowTestCoverage

Gotchas

  • Flow interview limit: 250,000/day for scheduled flows — plan accordingly
  • DML inside loops in flows hits governor limits just like Apex
  • $Record changes in before-save flows only commit when the record saves
  • Formula fields don't reflect changes made earlier in the same flow
  • Scheduled flows run in system context — no WITH USER_MODE equivalent
  • No native retry mechanism for failed callouts in flows
  • Collection variables can consume significant memory with large datasets
  • Subflow variable mapping must match types exactly — null/type mismatches cause runtime errors
  • Custom permission checks are cached — recent changes may not reflect immediately

Workflow

1. If migrating: Read existing PB metadata with Glob/Read tools 2. Analyze requirements or existing automation logic 3. Generate .flow-meta.xml file(s) 4. Generate any required Custom Permission metadata 5. Deploy dependencies first, then flows 6. Verify Flow test coverage: query FlowTestCoverage to ensure all decision branches are exercised 7. Provide verification steps

References

  • Flow Elements — complete XML reference for all element types, connectors, fault handling
  • Global Variables — complete $Variable reference with all accessible fields

Related skills

How it compares

Use as a Flow XML snippet reference, not as a substitute for Salesforce’s full element catalog or org-specific governor-limit testing.

FAQ

Who is sf-flow for?

Developers and Salesforce implementers who author or review Flow metadata XML with AI coding agents.

When should I use sf-flow?

Use during Build while creating assignments, variable math, record field copies, and collection updates inside Salesforce Flows.

Is sf-flow safe to install?

It is documentation-only XML patterns—review the Security Audits panel on this page and always validate flows in a sandbox before production deploy.

Backend & APIsintegrationsbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.