0

I would like to prevent users from adding more than one Product to an Opportunity (Number of Opportunity products must = 0 or 1) without using code. I have tried creating validation around the 'HasOpportunityLineItem' field but this can only be set to either True or False. Any ideas?

1 Answer 1

0

You should be able to add a RollUp Summary field to Opportunity that is a COUNT of Opportunity Products, then use a Validation Rule validate that it is either 0 or 1.

2
  • Thanks Dominic. I also have a similar requirement for Leads. I would like to prevent users adding more than one records of Custom Object - 'X' to a Lead record (Lookup relationship). Since it is not possible to have Leads as the Master in a Master-Detail relationship I cannot create a Roll-Up summary field on the object, therefore I cannot run Validation from this field. Could you recommend any work-around for this?
    – Clehan1
    Nov 13, 2014 at 15:50
  • You could try installing and using @Andrew Fawcett 's github.com/afawcett/declarative-lookup-rollup-summaries
    – Dominic
    Nov 14, 2014 at 9:25

You must log in to answer this question.

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