You need to sign in to do that
Don't have an account?
Trying to Implement Advance currency Management for custom object
Hello Folks
Need help with Advance currency management, as the document says the A.C.M is supported only for opportunitues and not custom objects
I am trying to design the ACM for custom object, I have considered following custom fields
Field label- Input Amount
Field name - Amount__c
Datatype - Number(18, 0)
FIELD LABEL - Month End Date
FIELD NAME - Month_End_Date__c
DATA TYPE - Date
Field label- Converted Value
Field name - Converted_Value__c
Datatype - Currency(18, 0)
FIELD LABEL - Currency
FIELD NAME - CurrencyIsoCode (USD, EURO)
DATA TYPE - Picklist
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
Below is my trigger
Any help would be Highly Appriciated
Need help with Advance currency management, as the document says the A.C.M is supported only for opportunitues and not custom objects
I am trying to design the ACM for custom object, I have considered following custom fields
Field label- Input Amount
Field name - Amount__c
Datatype - Number(18, 0)
FIELD LABEL - Month End Date
FIELD NAME - Month_End_Date__c
DATA TYPE - Date
Field label- Converted Value
Field name - Converted_Value__c
Datatype - Currency(18, 0)
FIELD LABEL - Currency
FIELD NAME - CurrencyIsoCode (USD, EURO)
DATA TYPE - Picklist
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
Below is my trigger
trigger Convertedcurrency on Dated_Currency__c (before insert,before update) { List<DatedConversionRate> currencyTypeList = [SELECT Id, IsoCode, ConversionRate, StartDate, NextStartDate FROM DatedConversionRate ORDER BY NextStartDate DESC]; Map<String , Decimal> isoWithRateMap = new Map<String, Decimal>(); for(DatedConversionRate c : currencyTypeList){ isoWithRateMap.put(c.IsoCode,c.ConversionRate); } for(Dated_Currency__c ce: trigger.new){ if(ce.Month_End_Date__c!=null && ce.CurrencyIsoCode != 'EUR' && isoWithRateMap.containsKey(ce.CurrencyIsoCode)){ ce.Converted_Value__c = ce.Amount__c/ isoWithRateMap.get(ce.CurrencyIsoCode); } if(ce.Month_End_Date__c!=null && ce.CurrencyIsoCode != 'USD' && isoWithRateMap.containsKey(ce.CurrencyIsoCode)){ ce.Converted_Value__c = ce.Amount__c/ isoWithRateMap.get(ce.CurrencyIsoCode); } } }
Any help would be Highly Appriciated
As per your requirement, you need to convert the amount into INR if the currency is not equal to INR. So you just need to add a check that converts the EUR and USD values to INR. Please find the updated code below:
Let me know if I misunderstood your requirement. It would be good if you can given some examples with expected output.
Thanks,
Abhishek Bansal.
Thanks for your quick reply,
I tried your code, but its not working, As per my requirement, the USD and Euro conversion should be based on the values defined
in the Dated Exchange rates
Ex. in the Dated Exchange Rates I am giving the Dollar value as 0.014100 for Jan 1 to Jan 31st
Now in the record level if i give Input amount as 100 and monthly end date as Jan 1st the
and i am selecting as currency as USD, then the converted value should come as
100/0.014100 = 7,092.19
The same should happen for EUR based on the values given in the Dated Exchange Rates based on the Monthly end date,
The same should happen for EUR based on the values given in the Dated Exchange Rates based on the Monthly end date, I hope you have understood my requirement
Yes, I understand your requirement and in order to suggest some solutions I need to know the background in some more details. Can we connect on a call to discuss this in detail. I am sure we will sort it out in our call.
If possible please reach out to me on:
Gmail: abhibansal2790@gmail.com
Skype: abhishek.bansal2790
Phone: +917357512102
Thanks.