AI actions in Flow Builder
FlowMason exposes every AI primitive as a native Salesforce @InvocableMethod action. Drag them onto any canvas — Screen Flows, Record-Triggered Flows, Scheduled Flows — no Apex required.
@InvocableMethod (Flow), the @AuraEnabled + LWC drop-in (UI), and the public static Apex facade (code). All three call the same underlying method. Add a feature once, every surface gets it.
Available actions
| Action label | Category | What it does | Status |
|---|---|---|---|
| AI: Summarize Record | FlowMason AI | Generates a concise summary of any SObject record using an LLM | Shipped |
| AI: Classify Text | FlowMason AI | Classify free text into one of N categories (case routing, lead scoring) | Planned |
| AI: Extract Fields | FlowMason AI | Pull structured data from unstructured text into record fields | Planned |
| AI: Draft Reply | FlowMason AI | Draft an email reply using record context and conversation history | Planned |
| Run Pipeline | FlowMason AI | Execute any named pipeline — the Swiss Army knife for advanced flows | Shipped |
AI: Summarize Record — input and output reference
Input fields
| Field | Required | Default |
|---|---|---|
Record Id | Yes | — |
Prompt | No | 3-5 bullet summary |
Provider | No | Active provider |
Max Tokens | No | 400 |
Output fields
| Field | Type |
|---|---|
summary | Text |
model | Text |
inputTokens | Number |
outputTokens | Number |
errorMessage | Text |
// Flow Builder reference — the action's output fields:
// {!Run_AI_Summarize.summary} — generated text
// {!Run_AI_Summarize.model} — model used (e.g. anthropic/claude-opus-4-6)
// {!Run_AI_Summarize.inputTokens} — tokens consumed
// {!Run_AI_Summarize.outputTokens} — tokens generated
// {!Run_AI_Summarize.errorMessage} — populated on failure, blank on success
// Input fields:
// Record Id (required) — Id of the record to summarize
// Prompt (optional) — override the default summarization prompt
// Provider (optional) — override the active LLM provider
// Max Tokens (optional) — cap the output length (default: 400) Walkthrough: Screen Flow with AI summary
This builds a simple Screen Flow that takes a record Id and shows an AI-generated summary. Good for testing or adding a quick-access button to any record page.
- Setup → Flows → New Flow → Screen Flow → Create
- Add a Screen element — drag a Text input field labeled Record Id (
recordIdInput, Required) - Add an Action element → search Summarize → pick AI: Summarize Record (under FlowMason AI)
- In the action config, set Record Id →
{!recordIdInput} - Add another Screen element — drag a Display Text component. Use the resource picker (
{!) to insert{!Run_AI_Summarize.summary}and{!Run_AI_Summarize.errorMessage} - Save → Debug with any record Id → Run. The summary appears in 5–10 seconds.
- Activate when ready.
Run_AI_Summarize — not lowercase. Always use the resource picker ({! in any text field) to avoid typos.
Walkthrough: Record-Triggered Flow
This auto-generates an AI briefing on an Opportunity's Description field whenever it moves to a specific stage. Zero maintenance — it fires whenever the entry condition is met.
// Record-Triggered Flow — Action configuration
// Object: Opportunity
// Trigger: A record is updated
// Entry: StageName Equals "Proposal/Price Quote"
// Optimize: Actions and Related Records
// AI: Summarize Record — Input Values:
// Record Id = {!$Record.Id}
// Prompt = "Write a 4-bullet briefing for the AE about this Opp just
// moved to Proposal/Price Quote. Focus on what matters most."
// Max Tokens = 300
// Update Records — after the action:
// Opportunity.Description = {!Generate_Briefing.summary} - New Flow → Record-Triggered Flow → Object: Opportunity → Trigger: A record is updated
- Entry Conditions:
StageName Equals "Proposal/Price Quote" - Optimize for: Actions and Related Records
- Add AI: Summarize Record → Record Id:
{!$Record.Id}→ custom prompt → Max Tokens: 300 - Add Update Records → write
{!Generate_Briefing.summary}toOpportunity.Description - Save → Debug → pick a test Opportunity, trigger as update to the matching Stage → Run
- Activate.
Using the Apex facade directly
The @InvocableMethod and the public static Apex method call the same underlying logic. You can use either — pick what fits your context.
// Simplest form — default prompt, returns summary string
String summary = FMSummarize.of(recordId).summary;
// Custom prompt
FMSummarize.Response r = FMSummarize.of(oppId, 'Write a 3-bullet AE briefing');
if (String.isBlank(r.errorMessage)) {
opportunity.Description = r.summary;
update opportunity;
}
// Full control — provider, prompt, and token limit
FMSummarize.Response r2 = FMSummarize.summarizeRecord(
caseId,
'Summarize this case for a manager escalation email',
'anthropic',
300
); Bulk considerations
Each call to a FlowMason action makes one LLM callout. Salesforce's governor limit is 100 callouts per transaction. If your flow processes 200 records in a single transaction, you'll hit this limit.
// The @InvocableMethod signature (called by the platform in bulk):
// FMSummarize.summarize(List<FMSummarize.Request>) returns List<FMSummarize.Response>
//
// When Flow processes multiple records in bulk, Salesforce batches the requests.
// Each request is an independent LLM call — 200 records = 200 callouts.
// For bulk processing, use the Trigger Framework with async execution instead.
// Invocable request fields:
FMSummarize.Request req = new FMSummarize.Request();
req.recordId = someAccount.Id; // Required
req.prompt = 'Custom prompt'; // Optional
req.provider = 'anthropic'; // Optional
req.maxTokens = 300; // Optional (default 400) For bulk operations, use the Trigger Framework with async execution mode — it fans each record out through a Queueable chain, keeping each transaction well within governor limits.
Troubleshooting
Action doesn't show in Flow search
FlowMason_Full_Access to both the running user and the admin building the flow. Also try typing "Summarize" instead of browsing categories.summary is blank, errorMessage says "Provider is required"
LLMProviderConfig__mdt record has IsActive__c = true. Setup → Custom Metadata Types → LLM Provider Config → activate one.The resource reference says it doesn't exist in the flow
{!) instead of typing it manually.