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
AthiSachiAthiSachi 

How to pass list of ids(or String concatenated Ids) from flow to invocable Method

Hi all,
Long story short, In order to avoid bulkification in code, I am trying to send list of Ids to invocable method to read values from opportunity table.
Now comes another challenge,  Invocable method takes only list string and flow input variable only pass single paramter. 
I have list of ids as collection variable as well as concatenated string. I passed concatenated string to List of string input parameter. But that didn't work. Please help me how to pass the input in my scenario?

global class LookupOpp {


   @InvocableMethod

public static List<List<Opportunity>> getOppIds(List<String>Ids) {

      List<Opportunity> Opps = [SELECT Id,GiGis_Opportunity_Posted__c FROM Opportunity WHERE Id in :Ids];
     
  
          List<List<Opportunity>> listOfOpps = new List<List<Opportunity>>();
             System.debug('Map Opportunity Size '+ listOfOpps.size());
            System.debug('=== contents of opptymap: ' +listOfOpps);

      listOfOpps.add(Opps);
      return listOfOpps;
 
   }
}
Best Answer chosen by AthiSachi
AthiSachiAthiSachi
Just In case Want to know work around. 

Flow passes Concatenated Id as (Id1,Id2,Id3) to invocable method. It sit as first list Ids[0]. Convert Ids[0] to array. It works

global class LookupOpp {


   @InvocableMethod

public static List<List<Opportunity>> getOppIds(List<String>Ids) {


String[] VarIds = Ids[0].split(',');

      
      List<Opportunity> Opps = [SELECT Id,GiGis_Opportunity_Posted__c FROM Opportunity WHERE Id in :VarIds];
     
  
          List<List<Opportunity>> listOfOpps = new List<List<Opportunity>>();
             System.debug('Map Opportunity Size '+ listOfOpps.size());
            System.debug('=== contents of opptymap: ' +listOfOpps);

      listOfOpps.add(Opps);
      return listOfOpps;
 
   }
}