I have a custom object "Sales Order" which is master and i have custom object "Invoice" which is child.It has lookup relation ship.I have written a rollup summary using trigger as it has lookup relationship.Invoices can have multiple currency.So i need to get roll up summary field with multi currency support.is it possible to get sum of amount of all invoices in converted currency. below is my code snippet :
Decimal Sum;
for(Sales_Quota__c objSalesQuota : [select Id,Actuals__c,(select Id,convertCurrency(Total_Price__c) from Invoices__r) from Sales_Quota__c where Id IN: salesQIds]){
Sum=0;
for (Invoice_CU__c objInv:objSalesQuota.Invoices__r){
Sum+= objInv.Total_Price__c;
}
objSalesQuota.Actuals__c = Sum;
salesQuotaList.add(objSalesQuota);
}
try{
update salesQuotaList;
}Catch(Exception e){
System.debug('Exception :'+e.getMessage());
}
When it sums up it is not in converted currency.