You need to sign in to do that
Don't have an account?
Dritter
When I add order.Paid__c = true to the trigger below, I get a Fatal Error. Can someone explain why and the best way to handle this issue? I'm trying to generate a new object for paid orders we take from the website. All of the amount fields are summary rollups or formulas, so I can use them.
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 (order.Paid__c = true && orderUpdate.origin1__c != order.origin1__c){
if (myString1.equalsIgnoreCase(order.Origin1__c)){
System.debug('TC trigger is after');
TermsandConditionsFutureMP.createTermsandConditionsMP (Trigger.newMap.keySet());
}
}
}
}
System.debug('TC trigger has been executed');
}
FATAL_ERROR|System.FinalException: Record is read-only
When I add order.Paid__c = true to the trigger below, I get a Fatal Error. Can someone explain why and the best way to handle this issue? I'm trying to generate a new object for paid orders we take from the website. All of the amount fields are summary rollups or formulas, so I can use them.
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 (order.Paid__c = true && orderUpdate.origin1__c != order.origin1__c){
if (myString1.equalsIgnoreCase(order.Origin1__c)){
System.debug('TC trigger is after');
TermsandConditionsFutureMP.createTermsandConditionsMP (Trigger.newMap.keySet());
}
}
}
}
System.debug('TC trigger has been executed');
}
change
if (order.Paid__c = true && orderUpdate.origin1__c != order.origin1__c){
to
if (order.Paid__c && orderUpdate.origin1__c != order.origin1__c){