I want to write a trigger on opportunity there is a field on account Opportunity_Amount__c if suppose Opportunity_Amount__c has value 200 and sum of its relted Opportunities is 160 and you are adding opportunity of amount 60 then it should throw error. if you are adding 40 or 30 it should not throw error while saving opportunity.
sum of total opportunities should not be greater than value in Opportunity_Amount__c.
Thanks
I want to write a trigger on opportunity there is a field on account Opportunity_Amount__c if suppose Opportunity_Amount__c has value 200 and sum of its relted Opportunities is 160 and you are adding opportunity of amount 60 then it should throw error. if you are adding 40 or 30 it should not throw error while saving opportunity.
sum of total opportunities should not be greater than value in Opportunity_Amount__c.