Is it possible to add products to an opportunity using the standard price?

Salesforce wants me to choose a price book in order to add products to an opportunity, but our organisation has opted not to use price books because we never deviate from the standard price. However it appears I cannot add ANY products to an opportunity without creating a price book and adding them to that.

So I ask firstly is there any way to turn off this behaviour and just let opportunity use the standard price, and also if there is no way to do this what is the point of the standard price?

Answer

Any special reason why you can’t have a small trigger?

trigger oppWorkaround on Opportunity(before insert, before update){
    for(Opportunity o : trigger.new){
        if(o.Pricebook2Id == null){
            o.Pricebook2Id = 'hardcoded id here';
        }
    }
}

Put the id of your standard pricebook and you’re done (except developer sandboxes). Bit better way would be to waste 1 query to SELECT Id FROM Pricebook2 LIMIT 1.

You will still need to specify PricebookEntries for products you want to be selectable (but since you mention standard prices I assume you’re aware of that).

Attribution
Source : Link , Question Author : Adam , Answer Author : eyescream

Leave a Comment