I am getting a very strange exception when trying to invoke Apex from a Flow:
Sandbox: Error Occurred During Flow "Account_Update_Lead_and_Contact_Fields": An Apex error occurred: System.UnexpectedException: Illegal arguments
Here's the invocable apex element in the Flow. (Note that the Input variables wouldn't allow me to assign like this if the data types were not compatible. As you can see in the email error message below, the SObject Collection Variable 'updatedLeads' had a value.)
Here are my invocable variables:
public class InvokedRequest {
@InvocableVariable
public String dmlType;
@InvocableVariable
public List<Lead> inputLeads;
}
I already ruled out the dmlType string being an issue (I removed it and got the same error). Here's the relevant section from the Flow error email:
SOBJECTDML_INVOCABLE (APEX): Perform_DML Inputs:
inputLeads = {!updatedLeads} ([00Qj000000HbdWLEAZ])
Error Occurred: An Apex error occurred: System.UnexpectedException: Illegal arguments