0

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

2
  • 1
    updatedLeads is an sobject collection and not a collection of IDs?
    – cropredy
    Commented Feb 21, 2018 at 4:54
  • @cropredy Well it’s passed in from PB as an sObject reference so I assume so. The Collection variable in Flow is declared as an SObject Collection. I would rather not have to requery...
    – Mike
    Commented Feb 21, 2018 at 5:09

1 Answer 1

0

Spoke to support and apparently, per this help article, methods/variables with the @InvocableMethod/Variable annotation do not support collection variable assignment from the Cloud Flow Designer.

1
  • That link is broken. Any idea what the explanation was? Commented Sep 21, 2019 at 9:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .