flow-cross-object-updates
Cross-object DML in Flow: updating parent from child or child from parent via Get/Update Records, lookup traversal in formulas, and bulkification. NOT for Apex cross-object updates. NOT for Process Builder (migrate-workflow-pb covers migration). Use when building flows that must write to a related record.
Best use case
flow-cross-object-updates is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Cross-object DML in Flow: updating parent from child or child from parent via Get/Update Records, lookup traversal in formulas, and bulkification. NOT for Apex cross-object updates. NOT for Process Builder (migrate-workflow-pb covers migration). Use when building flows that must write to a related record.
Teams using flow-cross-object-updates should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/flow-cross-object-updates/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How flow-cross-object-updates Compares
| Feature / Agent | flow-cross-object-updates | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Cross-object DML in Flow: updating parent from child or child from parent via Get/Update Records, lookup traversal in formulas, and bulkification. NOT for Apex cross-object updates. NOT for Process Builder (migrate-workflow-pb covers migration). Use when building flows that must write to a related record.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Flow Cross Object Updates
Activate when a flow must read or write a record other than the one that triggered it. Getting the pattern right avoids SOQL-inside-loop disasters and preserves bulk behavior when 200 records arrive at once.
## Before Starting
- **Identify the relationship direction.** Child→parent (lookup traversal) and parent→child (Get Records for related list) behave differently.
- **Check bulk context.** Record-triggered flows run with up to 200 records per batch — every Get/Update inside a loop multiplies by 200.
- **Prefer formulas for read-only parent fields.** `$Record.Account.Name` is free; a Get Records call is not.
## Core Concepts
### Child → Parent read: dot-notation traversal
In a Contact-triggered flow, `{!$Record.Account.Industry}` resolves the lookup in memory — no SOQL. Traverse up to 5 levels.
### Child → Parent write: single Update Records
```
Update Records:
Object: Account
Filter: Id = {!$Record.AccountId}
Fields to set: Last_Contact_Date__c = {!$Record.CreatedDate}
```
One DML per flow execution, regardless of batch size — Flow bulkifies automatically **as long as** the Update is outside a loop.
### Parent → Child: Get Records then Update Records
```
Get Records:
Object: Contact
Filter: AccountId = {!$Record.Id}
Store: All records in collection `contacts`
Loop contacts:
Assignment: each.Mailing_City__c = {!$Record.BillingCity}
Add to collection: contactsToUpdate
Update Records (outside loop):
Input collection: contactsToUpdate
```
**The Update Records is OUTSIDE the loop** — this is the single most important bulkification rule.
### Rollup-style aggregation
Salesforce has Rollup Summary only on master-detail. For lookups, use:
- `CollectionProcessor` (Count / Sum of a number collection) → single Update on parent
- Or Declarative Lookup Rollup Summaries (DLRS) — admin-friendly community app
## Common Patterns
### Pattern: "Last Activity" parent stamp
Record-triggered on Task create → Update Records on WhatId parent setting `Last_Task_Date__c = {!$Record.CreatedDate}`. One DML, fully bulk-safe.
### Pattern: Cascade status to children
Parent Account `Status__c` changes → Get Records (Contacts where AccountId = parent) → loop assign `Status__c` → Update outside loop.
### Pattern: Guard against recursion
Child → Parent update can retrigger a parent-triggered flow. Use an entry condition on the parent flow (`ISCHANGED(relevant field)`), or guard with a transient boolean custom setting.
## Decision Guidance
| Situation | Recommended Approach | Reason |
|---|---|---|
| Read parent field for decision | Dot-notation `$Record.Parent.Field` | No SOQL cost |
| Stamp a single field on parent | Update Records (no loop) | Bulkified by Flow engine |
| Update many children from parent change | Get Records → Loop assign → Update (outside loop) | Single DML regardless of count |
| Sum/count children | CollectionProcessor or DLRS | Rollup Summary lookup-incompatible |
| Update grandparent (Account → Opportunity → OpportunityLineItem) | Dot-traversal for read; separate Get+Update for writes | Nested updates aren't implicit |
## Recommended Workflow
1. Map the relationship direction and record volume expected.
2. Prefer dot-notation traversal for reads — avoid a Get Records when a formula suffices.
3. For writes, always keep Update Records OUTSIDE any Loop element.
4. Set entry conditions to prevent unneeded runs (ISCHANGED / ISNEW).
5. Add a Fault path on every Get/Update → Screen or custom error.
6. Test with 1, 2, and 200-record batches in a sandbox.
7. Verify SOQL/DML counts via Debug Logs — should be constant, not scaling.
## Review Checklist
- [ ] No Update/Create Records inside a Loop
- [ ] Dot-notation used where a Get Records is unneeded
- [ ] Entry conditions prevent unnecessary execution
- [ ] Fault paths present on every data element
- [ ] Bulk test (200 records) executed in sandbox
- [ ] SOQL and DML query counts verified constant
## Salesforce-Specific Gotchas
1. **Update Records inside Loop** — silent SOQL-101 killer when a batch arrives. No warning at design time; shows up only under load.
2. **Dot-notation returns null if intermediate lookup is empty** — always null-check: `IF(ISBLANK({!$Record.AccountId}), ..., {!$Record.Account.Name})`.
3. **Recursion between parent-triggered and child-triggered flows** — flow runs are not re-entrant by default, but cross-object updates can chain-trigger other flows. Monitor the flow execution stack in the debug log.
4. **Record-triggered flows on a child can't see parent field values that were just set by a before-trigger on the parent in the same transaction** — order-of-execution still applies.
5. **Scheduled paths lose context of original record** — if you rely on `$Record` in a scheduled path, pick up a fresh copy with Get Records.
## Output Artifacts
| Artifact | Description |
|---|---|
| Bulkified child→parent stamp flow | Reference implementation for "last activity" pattern |
| Parent→children cascade flow | Get + Loop-assign + Update-outside-loop skeleton |
| Fault-path subflow | Reusable error capture and notification |
## Related Skills
- `flow/flow-best-practices` — naming, fault paths, documentation
- `flow/flow-bulk-testing` — verifying 200-record safety
- `apex/apex-trigger-handler-pattern` — when to switch from Flow to ApexRelated Skills
ip-range-and-login-flow-strategy
Design and implement Salesforce Login Flows (Screen Flows assigned to profiles or Experience Cloud sites) that run post-authentication to enforce conditional MFA, IP-based branching, terms-of-service acceptance, or user data collection. Covers Login Flow creation in Flow Builder, profile/site assignment, IP-aware decision logic, and ConnectedAppPlugin extension points. NOT for static IP allowlisting or profile Login IP Ranges (see network-security-and-trusted-ips), org-wide session policies, or SSO/SAML IdP configuration.
customer-data-request-workflow
Implement GDPR/CCPA data subject rights (access, deletion, rectification) using Salesforce Privacy Center and/or custom workflow. NOT for general backup or org-level data retention policy.
omnistudio-vs-flow-decision
Use when choosing between OmniStudio (OmniScript / Integration Procedure / FlexCard / DataRaptor) and Flow / Screen Flow / Apex for a given capability. Triggers: 'omnistudio or flow', 'omniscript vs screen flow', 'integration procedure vs subflow', 'flexcard vs lightning page'. NOT for general automation selection across Workflow/Process Builder/Apex (see automation-selection tree).
lwc-in-flow-screens
Use when building, reviewing, or troubleshooting a custom Lightning Web Component that runs inside a Flow screen element, covering @api props exposed to Flow, FlowAttributeChangeEvent for output, validate() for user input validation, and flow navigation events. Triggers: 'lwc in flow screen', 'FlowAttributeChangeEvent', 'flow screen component not updating', 'flow validate method', 'flow navigation from lwc'. NOT for custom property editors (use custom-property-editor-for-flow), NOT for embedding a flow inside an LWC (use flow/screen-flows), NOT for auto-launched flows.
lwc-cross-tab-state-sync
Use when an LWC needs to react to events that happen in another browser tab — record updates, login state, draft autosave, console-tab navigation. Triggers: 'sync data across tabs', 'BroadcastChannel LWC', 'storage event LWC', 'one tab updates the other', 'console workspace tab close detection'. NOT for state sync within the same Lightning page (use Lightning Message Service) or for server-pushed updates (use CometD or refreshApex).
custom-property-editor-for-flow
Use when building or reviewing an LWC Custom Property Editor for Flow screen or action configuration, including the `configurationEditor` metadata hook, builder-side APIs, validation, and value-change events. Triggers: 'custom property editor', 'Flow configuration editor', 'builderContext', 'inputVariables', 'configurationEditor'. NOT for ordinary runtime screen-component behavior when no Flow Builder design-time customization is involved.
slack-workflow-builder
Use this skill when designing or troubleshooting Slack Workflow Builder workflows that call Salesforce — especially the Salesforce connector step Run a Flow, mapping inputs/outputs, handling failures, and understanding limits. Triggers on: Slack Workflow Builder Salesforce, Run a Flow from Slack, autolaunched flow from Slack, Slack automation calling Salesforce. NOT for Salesforce Flow Builder tutorials unrelated to Slack (use flow skills), not for Flow Core Actions that send Slack messages from Salesforce (use flow-for-slack), not for initial org-to-workspace connection (use slack-salesforce-integration-setup), and not for building custom Slack apps outside Workflow Builder.
salesforce-connect-external-objects
Use when deciding whether Salesforce Connect and External Objects are the right fit for external data access, or when reviewing OData, cross-org, and custom adapter patterns, query limitations, and latency tradeoffs. Triggers: 'Salesforce Connect', 'External Objects', '__x', 'OData adapter', 'custom adapter'. NOT for ordinary ETL or replicated-data designs where the data should live inside Salesforce.
oauth-flows-and-connected-apps
Use when choosing or reviewing Salesforce OAuth flows and connected-app policy for integrations, including client credentials, JWT bearer, authorization code, device flow, scopes, and token lifecycle controls. Triggers: 'OAuth flow', 'connected app', 'client credentials', 'JWT bearer', 'refresh token', 'integration user'. NOT for record-level sharing design or for simple Named Credential usage when the auth-flow decision is already settled.
workflow-rule-to-flow-migration
Migrate Workflow Rules to record-triggered Flows: field update mapping, email alert migration, outbound message alternatives using Flow Core Actions, time-based workflow replacement with Scheduled Paths. NOT for Process Builder migration (use process-builder-to-flow-migration), NOT for building new flows from scratch.
subflows-and-reusability
Use when extracting reusable Flow logic into subflows, defining input and output variables, keeping parent flows maintainable, and sharing common automation contracts across multiple flows. Triggers: 'reuse this flow logic', 'how should subflow variables work', 'too much duplicated flow logic', 'subflow contract design'. NOT for Apex-called Flow execution direction or Flow Orchestration process design.
screen-flows
Use when designing or reviewing interactive Flow screen experiences, including navigation, validation, screen component choice, custom LWC screen components, and user-safe commit timing. Triggers: 'screen flow validation', 'back button behavior in flow', 'custom flow screen component', 'screen flow UX'. NOT for Experience Cloud guest exposure or custom property editor design-time tooling.