0

I am trying to figure it out how can I implement this idea, I saw that this question already been asked but I haven't found an answer for that.

Does someone maybe knows what are the options available? . . .

[I want to rephrase my question, Let's say I have 2 users in the ORG and they can see all products in it, If I have an opportunity in my system, I want that each user will be able to add product line item to the opportunity BUT only from the SET of products he is working with. I thought to set different pricebooks for different users but then realized that only one pricebook is permitted in an opportunity]

Thanks.

2
  • 3
    Each opportunity can have only one price book. My idea that I nearly implemented for a project a few years back was to create a new real price book for each opportunity (you can have unlimited price books), and add products to the price book via Visualforce pages.
    – sfdcfox
    May 17, 2015 at 8:29
  • @sfdcfox I want to develop similar functionality. Since you have already implemented, could you please let me know if there were any challenges you faced with suggested approach? Jan 21, 2020 at 7:41

1 Answer 1

1

An Opportunity may have only one pricebook. You can see this by looking at the SFDC Object Reference for Opportunity - there is a field called Pricebook2Id

As you no doubt have learned, each OpportunityLineItem references a PriceBookEntry via its PricebookEntryId field and SFDC enforces that those PriceBookEntries must belong to the Opportunity's Pricebook2

So, how to work around this?

Option 1 - Just use the Standard Pricebook wherein all products/prices must reside

Option 2 - Use your own custom uber-pricebook(s) - maybe your application permits logical but still distinct super-pricebooks - maybe one for Commercial versus Federal pricing as no Opportunity would have both Commercial and Federal SKUs

Option 3 @sfdcfox has a suggestion in his comment to your OP

Note that other parts of SFDC use PricebookEntries (PriceBook2Id) too so if you are using those aspects of SFDC, consideration their ramifcations:

  • Orderitem (Order)
  • QuoteLineItem (Quote)
  • ContractLineItem (ServiceContract)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .