I have invocable method and trying to pass wrapper as parameter. But i wanna run that in console. How can i do it? It gives me error wrong parameter when i am trying to pass Wrapper Object.

public class InvokeApexFromFlowController{
    @InvocableMethod(label='Invoke Apex')
    public static List<FlowOutputs> invokeThisMetho(List<FlowInputs> request) {
        List<FlowOutputs> results = new List<FlowOutputs>();
        return results;
    public class FlowInputs{
        public Account accountSobj;
        public String nameToBeUpdate;
    public class FlowOutputs{
        public String accountPreviousName;
        public String DMLResult;
  • 1
    Please edit your post to include the error message verbatim. If you are running an anonymous script and hitting the aforementioned error, you should include that script also.
    – Adrian Larson
    Sep 16 '21 at 13:50

You need to make a List of wrapper objects.

List<InvokeApexFromFlowController.FlowInputs> values = new List<InvokeApexFromFlowController.FlowInputs>();
InvokeApexFromFlowController.FlowInputs value = new InvokeApexFromFlowController.FlowInputs();
value.accountPreviousName = 'whatever';
value.DMLResult = 'whatever';

Now, just pass in values for the flow parameters.

  • Works perfect, thanks.
    – Tipsiduspi
    Sep 16 '21 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.