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
ARanjanARanjan 

Opportunity Validation rule prevent me from adding and deleting opportunity line item.

I have Validation rule on opportunity (when subscription product > 1 And " XYZ"  ISBLANK AND Problatity > 50)
show error message.
At current situation there is opportunity which satisfies all the condition, when I try to add product it throws error message on opportuniy multilineitem page.
I don't want opportunity validation rule to fire when I add or delete opportunity line item.
Only when someone edits opportunity.


AND
(
AND
(OR( Subscription__c > 0, Services__c > 0),AND(Probability >=0.5, Probability <> 1), ISPICKVAL(Pre_Buy_or_NRE__c,'NO'), ISBLANK(Text(Mission_Critical__c))

),

AND
(
$Profile.Name <> 'API Only User',$Profile.Name <> 'Custom System Administrator',$Profile.Name <> 'System Administrator',$Profile.Name <> 'Configuration System Administrator'
)

)

How do I acheive this?

 
SonamSonam (Salesforce Developers) 
When adding Opportunity line item, is there a trigger which is updating the Opportunity? Validation rules get triggered when there is a DML operation on the record.

You might want to check and make the trigger inactive if its not something that you need in the system else place a condition to not update the Opportunity..
 
ARanjanARanjan
No there is no trigger on Opportunity.
Strange is, currently "XYZ" field is blank. Subscription field = 0, NRE ='0' Probability is >50%
When I edit on opportunity i don't get error but when I try to add product I am getting error.
User-added image
SonamSonam (Salesforce Developers) 
Check for a trigger on Opportunity Product, not Opportunity..
SonamSonam (Salesforce Developers) 
The validation rule ont he screen looks like a one on the Opportunity Product > please check under Opportunity Product for validation rule:

Screenshot for reference below:
User-added image