• Smitha Kumari
  • NEWBIE
  • 0 Points
  • Member since 2020
  • Salesforce Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
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

User-added image

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
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

User-added image

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
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

}