You need to sign in to do that
Don't have an account?
sap
Problem while updating CurrencyIsoCode field in Triggers
Hi,
My organisation have enabled multi currencies.Im trying to update CurrencyIsoCode field of a custom object based on some condition.Trigger is getting saved but while testing the code it is throwing an Exception
This is the code im using
trigger PRCurrencyUpdate on Product_Request__c (before insert,before update)
{
Inventory__c inv =[Select currencyIsoCode from Inventory__c where Id= :Trigger.new[0].inventory_Name__c];
double currencycode=inv.currencyIsoCode;
Product_Request__c pr=[Select Id,currencyIsoCode from Product_Request__c where Id=:Trigger.new[0].Id];
pr.currencyIsoCode=currencycode;
update pr;
}
Can any one please help me resolving this issue.
Any pointers will be of great help.
Thanks in advance.
String currencycode=inv.currencyIsoCode;
It might work now, if not you should post the exception message.
This error occurs with both direct and indirect operations. The following is an example of an indirect operation:
I think you are trying to update the record (statement update pr) in the before update trigger which is causing you the exception.
Try removing that statement and check.