Salesforce Decode
Salesforcedecode
Back to questions
ApexIntermediateinvocableflowagent-actions

Design invocable Apex for Flow and Agentforce action contracts

Real World Scenario

Twelve Flows duplicate credit check logic. Agentforce needs same capability as invocable action with structured error responses.

Expected Answer

• Single invocable method with @InvocableMethod label and description for discoverability • Bulkified invocable handling List<Request> inputs up to Flow bulk limits • Typed Request/Response inner classes with @InvocableVariable annotations • Standard error envelope: success flag, error code, user-safe message • Idempotent design for retry from Flow fault paths • Unit tests invoking invocable directly with edge case inputs • Version invocable API carefully—breaking input changes break Flows silently

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Main difference: use case and scale. Single invocable method with @InvocableMethod label and description for discoverability. Bulkified invocable handling List<Request> inputs up to Flow bulk limits. Pick based on your integration pattern and team capability. Invocables are public API to declarative layer—treat signature changes like REST versioning. Balance speed of delivery with maintainability.

Architect Perspective

Invocables are public API to declarative layer—treat signature changes like REST versioning.