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

  • 1
    updatedLeads is an sobject collection and not a collection of IDs? – cropredy Feb 21 '18 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 Feb 21 '18 at 5:09
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.

  • That link is broken. Any idea what the explanation was? – CommonCoreTawan Sep 21 at 9:33

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.