You need to sign in to do that
Don't have an account?
how to convert other currency to usd
Hi i need to check the currency for an object and have to set the currency of a field to usd based on condition like this
if(opp.CurrencyIsoCode !='USD')
{
here i need to convert other currency to usd for a field called as salesprice__c
}
if(opp.CurrencyIsoCode !='USD')
{
here i need to convert other currency to usd for a field called as salesprice__c
}
When exchange rates are updated they're stored in the CurrencyType object, so do something like this:
1 list<CurrencyType> c = [SELECT ISOCode, ConversionRate FROM CurrencyType WHERE IsActive=TRUE];<br>
So you have a list of currently active currencies and their exchange rate. To get currency values into your org's currency, just divde the value by that currency's exchange rate. for example:
1 for(integer i = 0; i< c.size(); i++){<br> if(Opp.CurrencyISOCode == c[i].ISOCode){<br> convertedCurrency = Opp.Amount / c[i].ConversionRate;<br> }<br>}
OR
OR
Double conversionRate = [SELECT conversionrate FROM currencytype WHERE isocode =: sISO LIMIT 1].conversionRate;
Please use the below trigger to convert slaes price to USD : Please use the conversion code in your trigger accordingly.
Let me know if you need more help on this.
Thanks,
Abhishek
@Abhishek:
How do I default to EUR instead of USD?
I am tring the same with Advance currency management,
In my Requirement the values should get picked from the "Manage dated currency exchange rate" ,
My Default currency is INR, I have enabled multiple currecny, I want to retrive all the conversion values based on months, I have
Defined it in the Manage Dated Exchange Rates,
In the Trigger I am fetching the Manage Dated Exchange Rates through an api called DatedConversionRate
I am using the SOQL query,
SELECT Id, IsoCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate
Now my requirement - Based on the Month End Date the conversionvalues should pickup for EUR or USD, The conversion rate should show in INR
I have modified the trigger, but i am not able to get the values
Any help would be very helpfull