Docs / Invocable Actions
Invocable Actions

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.

How it works: Every FlowMason primitive is exposed through three surfaces — the @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 labelCategoryWhat it doesStatus
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

FieldRequiredDefault
Record IdYes
PromptNo3-5 bullet summary
ProviderNoActive provider
Max TokensNo400

Output fields

FieldType
summaryText
modelText
inputTokensNumber
outputTokensNumber
errorMessageText
Flow Builder — output references
// 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.

  1. Setup → Flows → New Flow → Screen Flow → Create
  2. Add a Screen element — drag a Text input field labeled Record Id (recordIdInput, Required)
  3. Add an Action element → search Summarize → pick AI: Summarize Record (under FlowMason AI)
  4. In the action config, set Record Id{!recordIdInput}
  5. Add another Screen element — drag a Display Text component. Use the resource picker ({!) to insert {!Run_AI_Summarize.summary} and {!Run_AI_Summarize.errorMessage}
  6. Save → Debug with any record Id → Run. The summary appears in 5–10 seconds.
  7. Activate when ready.
Case sensitivity gotcha: Flow element API names are case-sensitive. The label Run AI Summarize becomes API name 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.

Flow Builder — configuration reference
// 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}
  1. New Flow → Record-Triggered Flow → Object: Opportunity → Trigger: A record is updated
  2. Entry Conditions: StageName Equals "Proposal/Price Quote"
  3. Optimize for: Actions and Related Records
  4. Add AI: Summarize Record → Record Id: {!$Record.Id} → custom prompt → Max Tokens: 300
  5. Add Update Records → write {!Generate_Briefing.summary} to Opportunity.Description
  6. Save → Debug → pick a test Opportunity, trigger as update to the matching Stage → Run
  7. 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.

Apex — FMSummarize facade
// 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.

Apex — bulk invocable
// 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
Assign 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"
No 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
Read the exact API name from the action element's properties panel — don't guess. Then use the resource picker ({!) instead of typing it manually.

What's next