+ Start a Discussion
dai tran 6dai tran 6 

How can search product ?

This is my SOSL:
List<List<sObject>> searchList=[Find :searchstring IN ALL FIELDS 
RETURNING  Product2(ProductCode,Name,ImageName__c), PricebookEntry(UnitPrice)];

Occur error:
entity type PricebookEntry does not support search

How can search product ?
Dhanraj Poojary 18Dhanraj Poojary 18
Hey Search is not Supported on Product2 Object. So a workarounf for this can be LIKE Operator with SOQL Query.
Example - 
String searchstring = 'Diesel';
list<Product2> products = [Select Id, Name From Product2 where Name LIKE :('%' + searchstring + '%')];
System.debug('Products List'+products);
I have checked it and its Working