• Valeriya Kim
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hello. I am trying to use the invocableMethod annotation to pass some ids from a flow to the method that will return a list of custom Sobjects.

For some reason the soql is only finding the first record, and I don't see why. Posted here is the class and a debug log. Thanks for any help!!
 
public with sharing class getCampaigns_Flow {
    
    @invocableMethod
    public static list<list<Campaign__c>> getCampaigns(list<string> campaignIds) {
        system.debug('campaignIds: '+campaignIds);
        list<list<Campaign__c>> varCamps = new list<list<Campaign__c>>();
        List<string> varIds = campaignIds[0].split(';');
        system.debug('varIds: '+varIds);
        list<Campaign__c> camps = [select Id,
                                    Target_Audience__c,
                                    Geographic_Targeting__c,
                                    Search_Keywords__c,
                                    Creative_Versions_Per_Flight__c
                                    from Campaign__c
                                    where Id In :varIds];
        varCamps.add(camps);
        system.debug('camps: '+camps);
        system.debug('varCamps: '+varCamps);
        return varCamps;
    }
}
User-added image