I have a validation rule for the Opportunity
object where in if the Opportunity
has a OpportunityLineItem
certain custom fields cannot be edited from the UI. Now I have a Trigger in the
OpportunityLineItemwhere in If I try to Add/Edit/Delete an
OpportunityLineItemthat is linked in it's
OpportunityIt will calculate those certain fields in the
Opportunity` object.
I already created a bypass checkbox in the Opportunity
object which is in it's default value = true.
Can Someone Guide me to complete this? Thank you in advance
This is my Validation Rule in The Opportunity
Object
(HasOpportunityLineItem &&
(ISCHANGED( Total_List_Price__c)) ||
(ISCHANGED( Total_End_User_Price__c)) ||
(ISCHANGED( Total_End_User_Price_Discount__c)) ||
(ISCHANGED( Total_Standard_Price__c)) ||
(ISCHANGED( Total_Standard_Price_Discount__c)) ||
(ISCHANGED( Total_SPR_Price__c)) ||
(ISCHANGED( Total_SPR_Price_Discount__c)) ||
(ISCHANGED( Total_Price__c)) ||
(ISCHANGED( Total_Price_Discount__c)) ||
(ISCHANGED( Total_SPR_Margin__c)) ) && dummyCheckbox__c == True
and this is my Trigger in the OpportunityLineItem
Object
trigger TotalOpportunityProductTrigger on OpportunityLineItem (after insert, after update, after delete) {
Opportunity Oppor = new Opportunity();
LPGCalculatorSettings__c objCalSetting = LPGCalculatorSettings__c.getValues('RollupTriggerSwitch');
if(objCalSetting.value__c){
TotalOpportunityProductTriggerHandler tp = new TotalOpportunityProductTriggerHandler();
if(Trigger.isInsert && Trigger.isAfter){
tp.TotalField(Trigger.new);
oppor.dummyCheckbox__c = False;
}
else if (Trigger.isUpdate && Trigger.isAfter){
tp.TotalField(Trigger.new);
oppor.dummyCheckbox__c = False;
}
else if(Trigger.isDelete && Trigger.isAfter){
tp.TotalField(Trigger.old);
oppor.dummyCheckbox__c = False;
}
}
}
Can someone help me to complete this one? I don't even know if I am in the right path. Thanks