7

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"

Thanks!

6

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 May 12 '16 at 20:27
  • awesomeee, din't know there was a flag for this – Rao May 12 '16 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 May 12 '16 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 May 12 '16 at 20:31
  • @Rao we have to call fim sfdcyoda – o-lexi May 12 '16 at 20:33
3

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 May 12 '16 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.