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
Alex MerwinAlex Merwin 

Product Custom Field - No Pricebook Entry Exists

Frequently our users create products and forget to create associated pricebook entries. 

I'm trying to create reporting / dashboards to show users when this happens, so they can go back and add prices. 

Idea is to create a custom field on the Product that is a formula(checkbox) field if that is TRUE if the Product has no Price book entry associated with it. 

Has anyone tried this before? 
Lokeswara ReddyLokeswara Reddy
Hi Alex,

There is not look up from Product to PricebookEntry, so you can not achive directly this through a formula field on Product object. Even custom report type is also not possible.

I could thingk of a VF page on Home page layout to show the list of Products without PricebookEntry.

1. Create a simple VF page to display the list of products which do not have Pricebook entry for the logged in user
    You can probably use query something like 
     [SELECT Id,Name, CreatedById FROM Product2 
                          WHERE CreatedById =:userinfo.getuserId() AND 
                          Id NOT IN (SELECT Product2Id FROM PricebookEntry)]

2. Add this VF page to Homepage layout.
Alex MerwinAlex Merwin
Hi - 

Thanks for your help, unfortunately we haven't built a Visual Force page before and don't know how to create this. We made the VF page and entered the below but not seeing a list of Products as expected. Can you help? 

~ Alex
 
<apex:page>
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
     [SELECT Id,Name, CreatedById FROM Product2 
                          WHERE CreatedById =:userinfo.getuserId() AND 
                          Id NOT IN (SELECT Product2Id FROM PricebookEntry)]                   
  <!-- End Default Content REMOVE THIS -->
</apex:page>

 
Lokeswara ReddyLokeswara Reddy
Hi Alex,

Please reach out me on ylokesh@gmail.com if you need further assistance.

Regards
Lokesh