• ramify
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

I have a query string that I am passing to a Batch Apex method.  I want to include a Set's values in the where clause of the string.  How do I include the set in the string so that it will be parsed correctly?  The example below results in an "unexpected token error" in the debug log when the batch executes.

 

Set<Id> oppIDs = new Set<Id>{id1, id2, id3. etc etc};
CalYearEndBatch cyBatch = new CalYearEndBatch();
cyBatch.query = 'select Role, Opportunity.Amount from OpportunityContactRole where Opportunity__c in:\'' + oppIDs + '\'';
Id batchprocessID = Database.executeBatch(cyBatch);

 

 

Good day, 

 

If i have following query :

 

 

Select a.Name , (Select userId From AccountTeamMembers WHERE TeamMemberRole='Sales') From Account a where id='0013000000H0EMSS'

 

 

How can i get the userId ?

 

Thanks in advance !