You need to sign in to do that
Don't have an account?
Dritter
Problem with Formula Fields in an APEX Trigger - can they be used?
I created the trigger below, which is set to fire when this field ccrz__TotalAmount__c is greater than zero and the origin equals website. The ccrz__TotalAmount__c is a formula and the debug log shows it is greater than $0, but it's still not firing the method. The trigger is an after update, so I figure the formula field would work. Any ideas?
The other problem is all of the currency fields are either summary roll ups or formulas, so no matter which one I use I face the same problem.
trigger TermsandConditionsFutureMP on ccrz__E_Order__c (after update) {
System.debug('TC Start execution of trigger');
if(trigger.isAfter){
String myString1 = 'Website';
for (ccrz__E_Order__c order:trigger.new){
ccrz__E_Order__c orderUpdate = System.Trigger.oldMap.get(order.id);
if (orderUpdate.origin1__c != order.origin1__c){
if (order.ccrz__TotalAmount__c > 0 && myString1.equalsIgnoreCase(order.Origin1__c)){
System.debug('TC trigger is after');
TermsandConditionsFutureMP.createTermsandConditionsMP (Trigger.newMap.keySet());
}
}
}
}
System.debug('TC trigger has been executed');
}
The other problem is all of the currency fields are either summary roll ups or formulas, so no matter which one I use I face the same problem.
trigger TermsandConditionsFutureMP on ccrz__E_Order__c (after update) {
System.debug('TC Start execution of trigger');
if(trigger.isAfter){
String myString1 = 'Website';
for (ccrz__E_Order__c order:trigger.new){
ccrz__E_Order__c orderUpdate = System.Trigger.oldMap.get(order.id);
if (orderUpdate.origin1__c != order.origin1__c){
if (order.ccrz__TotalAmount__c > 0 && myString1.equalsIgnoreCase(order.Origin1__c)){
System.debug('TC trigger is after');
TermsandConditionsFutureMP.createTermsandConditionsMP (Trigger.newMap.keySet());
}
}
}
}
System.debug('TC trigger has been executed');
}
Ramu (Salesforce Developers)
Changes in formula field are not considered as DML events hence the trigger wont fire with the changes in formula field.