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
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