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
mpoiriermpoirier 

Searching Pricebook Entries

I had code that searched the Product2 object.

 

I changed this code to use the Pricebook instead but now the FIND command does not seem to work on this object.

 

It never returns with PB Entries...

 

This code works:

 

pricebookEntries = [SELECT id, IsActive, Name, Product2Id, ProductCode, UnitPrice, UseStandardPrice from PricebookEntry WHERE (Pricebook2Id = :opp.Pricebook2Id) AND (IsActive = True) ORDER BY ProductCode];

This code does not work:

 

pricebookEntries = (List<PricebookEntry>)[FIND :searchText IN ALL FIELDS RETURNING PricebookEntry (id, IsActive, Name, Product2Id, ProductCode, UnitPrice, UseStandardPrice WHERE (Pricebook2Id = :opp.Pricebook2Id) AND (IsActive = True))][0];

Similar queries worked on the Product2 object...

 

I know there are special settings on the PriceBook to make it not visible in the web interface. 

 

Is there a restriction on the PriceBook objects that prevent a text search to work on those objects ?

 

Thanks for any hint on this...

 

Michel