0

I have a flow setup to pass in a collection of opportunities to process and send back a collection of opportunities. In the flow I have queried the opps, assigned them to a record collection variable and check the "Available for Output" option. However when I used the apex action in the flow, there is no option to pass the collection variable to the apex class. I am trying to understaynd why I can't pass in my record collection variable.

enter image description here

public class FindOpportunities {
@InvocableMethod(label='Find Opportunities')
public static List<List<Opportunity>> findOpps(List<Opportunity> oppList) {
    List<Opportunity> invalidOpps = new List<Opportunity>();
    
    for (Opportunity opp : oppList) {
        if (opp.AccountId != null && opp.Account.Type != 'Customer' && opp.Account.Account_Status__c != 'Active') {
            invalidOpps.add(opp);
        }
    }
    
    List<List<Opportunity>> result = new List<List<Opportunity>>();
    result.add(invalidOpps);
    
    return result;
}

}

1
  • 3
    Can you try keeping input parameter as List<List<Opportunity>> oppList and see if helps? Related Commented Mar 16, 2023 at 14:57

1 Answer 1

0

As you want to pass record collection variable to apex class, you need to use List<List<sObject>> as flows are bulkified and this is expected behavior.

Found this article having more information enter image description here

You must log in to answer this question.

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