+ Start a Discussion
Mac SwiftMac Swift 

Validation rule for Custom field on Opp

I have a requirement in my Organization where I need to make a custom Field Mandatory on Opportunity, if there is word "ABC" and "XYZ" in the product name (in the Opp Product line Item). 
Please help me to resolve the issue.
Thanks in Advance,
Shashikant SharmaShashikant Sharma
Hi Mac,

You need to write a Validaion rule on Opportunity Object based on Prudct Line Items so you need to get the information on the opportunity first.

1. Create a field Product Name on Opportunity Product object
2.Create a workflow rule / process builder / trigger on Opportunity Product object to populate it from Product Name
3. You need to create Rollup Summary Field On the Opportunity Object to get the Count of Products having word ABC and XYZ in field created

Count of records having word ABC and XYZ. 
Summarized Object     Opportunity Product
Roll-Up Type: Count
Filter Criteria: Only records meeting certain criteria should be included in the calculation
Filter is
Product Name contains ABC and XYZ. 

4. Once you have the count you could use it in Valdiation Rule.