3

I have a SOSL query that finds Salesforce Campaigns, and that's working just fine. However, I need to retrieve all Account Team Members for each returned Campaign. Is it possible to add a subquery to SOSL?

Here's what I have so far:

List<List<sObject>> searchList = 
    [FIND :CampaignSearchTerm RETURNING Campaign (Id Where IsActive = true Order By Name)];

If it is not possible, I have a different question. Can SOSL results be assigned to a Map or Set to avoid from having to put together all of the IDs in a for-loop for an SOQL query (for the sake of efficiency)?

Thanks!

Matt K
  • 6,747
  • 5
  • 36
  • 60
  • 1
    Gah.. I don't think this is possible. Apparently there is no documentation on subquerying within SOSL (also, it didn't work when I tried), and the documentation on SOSL states that SOSL only returns data in List> format. If anyone has a better solution, I'd be glad for suggestions. – Matt K Nov 15 '11 at 20:01

1 Answers1

1

You are correct :) But in terms of efficiency, SOSL is only bringing <= 200 results so producing Id lists for SOQL should have a negligible impact.

Adam
  • 2,595
  • 1
  • 14
  • 20
  • I ended up using a mix of SOSL and SOQL based on different conditions. Thanks for the reminder about the 200 record limit on SOSL. – Matt K Dec 05 '11 at 14:27