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?
Attribution to: Adam
Possible Suggestion/Solution #1
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 to: eyescream
Possible Suggestion/Solution #2
Found out how it is possible. I just hadn't activated the standard price book. For anyone reading this question looking for an answer go to Products, then find Manage Price Books down in maintenance at the bottom, then navigate to Standard Price Book and either click activate on the search results or click to get to its detail page and check the Active field. This will cause it to be selectable when adding products to opportunities.
Attribution to: Adam
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/31526