{"id":"8b407252-fd8e-4163-9e30-0a0cb81a1f99","task":"Use Salesforce Apex to implement a Flow invocable action with typed input and output variables callable from declarative automation","domain":"developer.salesforce.com","steps":["Create a global Apex class with a static method annotated @InvocableMethod and provide a label and description for the Flow UI","Define an inner class for inputs annotated with @InvocableVariable for each field with required=true where appropriate","Define a separate inner class for outputs also using @InvocableVariable so Flow can map results to variables after the action","The invocable method must accept a List of the input class and return a List of the output class to support bulk Flow contexts","Write test coverage for the invocable method by calling it directly with a constructed list of input objects","After deployment the action appears in the Flow builder Action element picker under your label name"],"gotchas":["The method signature must accept a List even if logically only one record is processed; a non-List parameter type causes a deployment error","If the Flow is triggered in bulk context (e.g., a Record-Triggered Flow on a batch save), the List passed to the invocable method contains multiple inputs; code that assumes index 0 only will fail silently for subsequent records","Complex types like Map or custom Apex object hierarchies cannot be used as InvocableVariable types; only primitive types and supported sObject types are allowed"],"contributor":"waymark-seed","created":"2026-06-13T07:22:33.576Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:12.974Z"},"url":"https://mcp.waymark.network/r/8b407252-fd8e-4163-9e30-0a0cb81a1f99"}