You need to sign in to do that
Don't have an account?
Tracey Okeby Lucan
Apex trigger failing with new currencies in the org
Help! This Apex Trigger has been working in the Org since before my time but it refuses to deail with the new currencies in prodcuts/opportunities. Anyone got any ideas why?
trigger OppQuotaTrigger on Opportunity (before insert, before update, after insert, after update) {
if (trigger.isBefore) {
OppQuota.populateOppQuotaBudget(trigger.new);
} else if (trigger.isAfter) {
OppQuota.spawnTermOppNewContract(trigger.new);
if (trigger.isUpdate) {
OppQuota.updateOriginalOpp(trigger.old, trigger.new);
}
}
}
This is the error message I am getting but I don't understanding it as the Account, Opp and Product all have matching Currency Codes.
Error:Apex trigger OppQuotaTrigger caused an unexpected exception, contact your administrator: OppQuotaTrigger: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry currency code does not match opportunity currency code): [PricebookEntryId]: Class.OppQuota.spawnTermOppNewContract: line 218, column 1
trigger OppQuotaTrigger on Opportunity (before insert, before update, after insert, after update) {
if (trigger.isBefore) {
OppQuota.populateOppQuotaBudget(trigger.new);
} else if (trigger.isAfter) {
OppQuota.spawnTermOppNewContract(trigger.new);
if (trigger.isUpdate) {
OppQuota.updateOriginalOpp(trigger.old, trigger.new);
}
}
}
This is the error message I am getting but I don't understanding it as the Account, Opp and Product all have matching Currency Codes.
Error:Apex trigger OppQuotaTrigger caused an unexpected exception, contact your administrator: OppQuotaTrigger: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId (pricebook entry currency code does not match opportunity currency code): [PricebookEntryId]: Class.OppQuota.spawnTermOppNewContract: line 218, column 1