Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- List of Products not on the Pricebook
turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
0
List of Products not on the Pricebook
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-25-2013 10:18 AM
This is my first project where I need to make a list of products that are not in a pricebook. I have written the basic code below to render a list of products not included in a pricebook.
public class ProductsnotinFY13PB{
id FY13PB = [select id from Pricebook2 where name = 'FY13 Global Pricebook'].id;
List<Product2> inactivep = [select id from Product2 where (select id from pricebookentry where
pricebook2id =: FY13PB).size()=0];
}
and I am receiving the following error:
Error: Compile Error: unexpected token: 'select' at line 5 column 63
How do I correct this error?
Thanks
Solved! Go to Solution.
0
Re: List of Products not on the Pricebook
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-25-2013 10:41 AM
I believe you need to use the IN and NOT IN operators here as in:
SELECT id, Name FROM Product2 where id NOT IN (select product2id from pricebookentry where pricebook2Id = :FY13PB)
see:
Eric
0
Re: List of Products not on the Pricebook
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-25-2013 10:44 AM
Thank you very much.

