--- name: building-system-context-agent-data-flows description: Build the backing data flows for an Agentforce Service Agent (ASA) so they read and write records in system context regardless of the agent user's sharing/perms. Covers the read pattern (prompt-template-over-PromptFlow + system-context subflow), the write pattern (autolaunched flow action), and the critical empty-results bug where a PromptFlow silently returns zero rows because it runs as the agent user. --- # Building System-Context Data Flows for Agents ## What this skill is for An Agentforce Service Agent (ASA) reaches data through **actions** backed by Flows and Prompt Templates. Those flows run as the **agent user**, whose license and sharing routinely block the records the demo needs to show. The fix — mandated on every build here — is: **every flow that backs an agent action or a prompt template runs in System Context without sharing.** This skill is the exact, verified mechanics for that, including the one bug that silently breaks reads. Three flow shapes, all `SystemModeWithoutSharing`: | Shape | processType | Used for | Agent action target | |---|---|---|---| | **Read** — thin PromptFlow that calls a system-context subflow | `PromptFlow` (wrapper) + `AutoLaunchedFlow` (subflow) | listing/looking up records for the model to narrate | `generatePromptResponse://