// ───────────────────────────────────────────────────────────────────────────── // 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 input, // Map output, // Map options) { // if (methodName == 'createOrder') { // output.putAll(createOrder(input, options)); // return true; // } // return false; // } // // private Map createOrder(Map inputMap, // Map options) { // return new Map{ 'success' => true }; // } // } // ───────────────────────────────────────────────────────────────────────────── // AFTER: System.Callable // Same inputs (inputMap, options); return value replaces outputMap mutation. // Action strings mirror the original methodName values to keep callers stable. // ───────────────────────────────────────────────────────────────────────────── public with sharing class Industries_XxxCallable implements System.Callable { public Object call(String action, Map args) { Map inputMap = (args != null && args.containsKey('inputMap')) ? (Map) args.get('inputMap') : (args != null ? args : new Map()); Map options = (args != null && args.containsKey('options')) ? (Map) args.get('options') : new Map(); if (inputMap == null) { inputMap = new Map(); } if (options == null) { options = new Map(); } switch on action { when 'createOrder' { return createOrder(inputMap, options); } when else { throw new IndustriesCallableException('Unsupported action: ' + action); } } } private Map createOrder(Map inputMap, Map options) { // Validate input, run business logic, return response envelope return new Map{ 'success' => true, 'data' => new Map() }; } }