• Manish Anand 12
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hi,
I am trying to execute below SOSL query in Apexcode:

List<List<Sobject>> searchlist=[FIND 'Pencil*' IN ALL FIELDS RETURNING Merchandise__c (Id,Name), Invoice_Statement__c];
Merchandise__c[] merList = ((List<Merchandise__c>) searchList[0]);
Invoice_Statement__c[] invList = ((List<Invoice_Statement__c) searchList[1]);
System.debug('Found' + merList.size() + 'merchandise items.'); 
System.debug('Found' + invList.size() + 'invoice statements.');

I get an error message- Unexpected Token: 'List'
What could be the reason?
 
Hi,
I am trying to execute below SOSL query in Apexcode:

List<List<Sobject>> searchlist=[FIND 'Pencil*' IN ALL FIELDS RETURNING Merchandise__c (Id,Name), Invoice_Statement__c];
Merchandise__c[] merList = ((List<Merchandise__c>) searchList[0]);
Invoice_Statement__c[] invList = ((List<Invoice_Statement__c) searchList[1]);
System.debug('Found' + merList.size() + 'merchandise items.'); 
System.debug('Found' + invList.size() + 'invoice statements.');

I get an error message- Unexpected Token: 'List'
What could be the reason?