function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Himanshu jain 46Himanshu jain 46 

Validation opportunity

if i have to insert 1 opportunity product in opportunity. what will be the validation rule for that.
Best Answer chosen by Himanshu jain 46
Roshni RahulRoshni Rahul
Hi Himanshu,

I got solution for you.
1. First create a rollup summary field in Opportunity Object with child as product which calculate the count. 

User-added image

2. Then create a validation rule which check whether the count__c field value greater than 1 
User-added image

Now if you try to add one more product. Error will be thrown.

User-added image

Its working perfectly for me. If same for you, Please mark my answer as best answer.

Regards,
Roshni
 

All Answers

Roshni RahulRoshni Rahul
Hi,
 can you please elaborate what is your requirement
 
Himanshu jain 46Himanshu jain 46
i have to insert only 1 line item product to my opportunity.
 
Roshni RahulRoshni Rahul
Hi Himanshu,

I got solution for you.
1. First create a rollup summary field in Opportunity Object with child as product which calculate the count. 

User-added image

2. Then create a validation rule which check whether the count__c field value greater than 1 
User-added image

Now if you try to add one more product. Error will be thrown.

User-added image

Its working perfectly for me. If same for you, Please mark my answer as best answer.

Regards,
Roshni
 
This was selected as the best answer
Himanshu jain 46Himanshu jain 46
Hello Roshni
Thanks for the help 
 
Roshni RahulRoshni Rahul
Can you please mark my answer as best answer if it helps