Invocable method accept only single list as a parameter. We can pass multiple parameters to an invocable method using an inner class.

In this example, record triggered flow has been used.

Flow multiple parameter invocable method
public with sharing class invocableClass 
{
    @InvocableMethod(Label='Multiple Parameters')
    public void passMultipleParameter(List<RequestClass> requestList)
    {
        //Example
        List<String> accountIds = new List<String>();
        for(RequestClass request: requestList)
        {
            accountIds.add(request.accountId);
        }
        //add your logic
    }

    public RequestClass
    {
        @InvocableVariable
        public Id accountId;

        @InvocableVariable
        public Id contactId;
    }
}

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *