How would i create a field (formula?) to check if a opportunity has products that I can use for validation logic: IF productscount>0 (or products not null, empty) AND Probability>50% Then - error message " Must add products to the opportunity"


2 Answers 2


There's a built-in field that identifies if an opportunity has a product attached. You can use this in your validation rule like this:

AND(NOT(HasOpportunityLineItem), Probability>0.5)
  • 3
    How do you know everything? ))
    – o-lexi
    Commented May 12, 2016 at 20:27
  • awesomeee, din't know there was a flag for this
    – Rao
    Commented May 12, 2016 at 20:27
  • 1
    @Oleksiy sfdcfox is not a human, sfdcfox is a super computer that salesforce runs on :P May have asked the same question "How do you know everything"
    – Rao
    Commented May 12, 2016 at 20:29
  • 2
    @Oleksiy I appreciate the flattery, but I definitely don't know everything (not even everything about salesforce.com). I just have the requisite 10,000+ hours of experience needed to be a master.
    – sfdcfox
    Commented May 12, 2016 at 20:31
  • @Rao we have to call fim sfdcyoda
    – o-lexi
    Commented May 12, 2016 at 20:33

Step 1: Create a rollup summary field to show the number of opportunity product

Step 2: AND( rollupsummaryfield >0 , probability > 50%) throw error

  • Rollup field isn't necessary, you know.
    – sfdcfox
    Commented May 12, 2016 at 19:05

You must log in to answer this question.

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