
Building Omnistudio Callable Apex
Scaffold System.Callable Apex for OmniStudio Open Interface callers with inputMap/options parsing and action routing.
Overview
Building OmniStudio Callable Apex is an agent skill for the Build phase that generates System.Callable Apex wired for OmniStudio inputMap/options callers and action-based dispatch.
Install
npx skills add https://github.com/forcedotcom/sf-skills --skill building-omnistudio-callable-apexWhat is this skill?
- System.Callable skeleton mirroring VlocityOpenInterface inputMap and options structure
- Backward compatibility: treats whole args as inputMap when inputMap key is absent
- Switch-based action dispatch with explicit unsupported-action exception type
- actionOne template steps: validate required keys, safe type coercion, then business logic
- inputMap and options dual-map parsing pattern
- switch-on-action dispatch with when-else guard
Adoption & trust: 570 installs on skills.sh; 513 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need OmniStudio or Open Interface to invoke Apex but keep mixing up inputMap/options parsing across actions.
Who is it for?
Salesforce developers wiring Industries OmniStudio, Vlocity-era Open Interface, or multi-action server hooks in a small team codebase.
Skip if: Projects with no OmniStudio/Vlocity callable requirements or teams that only need simple @InvocableMethod without Open Interface contracts.
When should I use this skill?
Creating or extending Apex System.Callable classes for OmniStudio/Vlocity callers that pass inputMap and options.
What do I get? / Deliverables
You ship a with-sharing Callable class with validated actions, safe map coercion, and a clear extension point for additional when branches.
- System.Callable Apex class with action routing
- Validated handler methods returning Map<String, Object> outputs
Recommended Skills
Journey fit
Callable Apex is integration glue you author while connecting OmniStudio, Flow, or external callers to server-side actions. Integrations subphase covers Vlocity/OmniStudio callable patterns and backward-compatible argument shapes.
How it compares
Callable Apex integration template—not a Lightning Web Component UI skill or a managed-package installer.
Common Questions / FAQ
Who is building-omnistudio-callable-apex for?
Backend Salesforce builders implementing OmniStudio server actions who want a consistent System.Callable entry point for multiple actions.
When should I use building-omnistudio-callable-apex?
During Build integrations when adding or refactoring Apex that OmniScripts, Integration Procedures, or Open Interface callers invoke with inputMap and options.
Is building-omnistudio-callable-apex safe to install?
It suggests Apex that runs in your org; review code before deploy and check the Security Audits panel on this page for the parent skill package.
SKILL.md
READMESKILL.md - Building Omnistudio Callable Apex
/** * System.Callable skeleton — same inputMap/options structure as VlocityOpenInterface. * Use when integrating with Open Interface callers or when callers pass { inputMap, options }. * Backward-compatible: if args lacks 'inputMap', treats args itself as inputMap. * * Replace Industries_XxxCallable and actionOne with the actual class/action names. */ public with sharing class Industries_XxxCallable implements System.Callable { public Object call(String action, Map<String, Object> args) { Map<String, Object> inputMap = (args != null && args.containsKey('inputMap')) ? (Map<String, Object>) args.get('inputMap') : (args != null ? args : new Map<String, Object>()); Map<String, Object> options = (args != null && args.containsKey('options')) ? (Map<String, Object>) args.get('options') : new Map<String, Object>(); if (inputMap == null) { inputMap = new Map<String, Object>(); } if (options == null) { options = new Map<String, Object>(); } switch on action { when 'actionOne' { return actionOne(inputMap, options); } when else { throw new IndustriesCallableException('Unsupported action: ' + action); } } } private Map<String, Object> actionOne(Map<String, Object> inputMap, Map<String, Object> options) { // 1. Validate required keys from inputMap // 2. Coerce types safely // 3. Run business logic (SOQL with WITH USER_MODE, DML with sharing) // 4. Return response envelope return new Map<String, Object>{ 'success' => true, 'data' => new Map<String, Object>() }; } } /** * Vanilla System.Callable skeleton — flat args, no Open Interface coupling. * Use when callers pass flat args and no VlocityOpenInterface integration is required. * * Replace Industries_XxxCallable and actionOne with the actual class/action names. */ public with sharing class Industries_XxxCallable implements System.Callable { public Object call(String action, Map<String, Object> args) { Map<String, Object> input = args != null ? args : new Map<String, Object>(); switch on action { when 'actionOne' { return actionOne(input); } when else { throw new IndustriesCallableException('Unsupported action: ' + action); } } } private Map<String, Object> actionOne(Map<String, Object> args) { // 1. Validate required keys (e.g. args.get('requiredKey')) // 2. Coerce types safely // 3. Run business logic (SOQL with WITH USER_MODE, DML with sharing) // 4. Return response envelope return new Map<String, Object>{ 'success' => true, 'data' => new Map<String, Object>() }; } } // ───────────────────────────────────────────────────────────────────────────── // BEFORE: VlocityOpenInterface2 // Results written into outputMap by reference; return value is Boolean success flag. // ───────────────────────────────────────────────────────────────────────────── // global class OrderOpenInterface implements omnistudio.VlocityOpenInterface2 { // global Boolean invokeMethod(String methodName, Map<String, Object> input, // Map<String, Object> output, // Map<String, Object> options) { // if (methodName == 'createOrder') { // output.putAll(createOrder(input, options)); // return true; // } // return false; // } // // private Map<String, Object> createOrder(Map<String, Object> inputMap, // Map<String, Object> options) { // return new Map<String, Object>{ 'success' => true }; // } // } // ─────────────────────────────────────────────────────────────────────────