function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric Smith 10Eric Smith 10 

How can I pass a SObject Collection variable from Visual flow to Apex?

I am trying to pass the result of a Fast Lookup from Visual Flow to an invocable Apex class and I am unable to get the Flow designer let me select the SObject Collection variable.  Any ideas on how to make this work?
User-added image
global class collectionSize {
    @InvocableMethod
    public static List<Integer> getCollection(List<OpportunityLineItem> vwfCollection) {
        List<Integer> countList = new List<Integer>();
        countList.add(vwfCollection.size());       
        return countList;
    }
}

 
Gaurav HandooGaurav Handoo
Hi Eric

Based on my experience, it only allows to pass Sobject Variables and Not the collection to an invokable class. So I believe you would have pass the bulk values in a loop.

Hope this helps.

Cheers!!

Gaurav