How to Initialize the Dated Exchange Rates on Existing Records After Setting Up Dated Exchange Rates for Custom Objects Functionality on Currency Updater
After you’ve successfully created a custom object rule for updating currency exchange rates in Salesforce, you may wonder how to initialize the dated exchange rates on existing records. This process is essential for ensuring that your records reflect the correct currency values based on historical conversion rates. Below is a guide to help you through this process.
Step 1: Verify the Rule Creation and Deployment
Once you’ve created a custom object rule by selecting the target object, the exchange rate field, and the date field, make sure to save the rule and check that the deployment status is marked as successful. This step ensures that your setup is correctly configured to update the exchange rates.
Step 2: Confirm the Availability of Historical Conversion Rates
Before proceeding, it’s crucial to ensure that your Salesforce organization has the historical conversion rates that you need. These rates are vital for accurately initializing the exchange rates on your records. If you’re unsure about how to upload historical rates or if they’re present in your system, feel free to reach out to support-at-axy7.com for assistance.
Step 3: Use the Currency Updater API
With the rule deployed and the necessary fields created, you can now utilize the currency updater API. This tool allows you to initialize the exchange rates for your records. To do this, access the Apex global interface in your Apex anonymous window and use the following code:
s4g_currencies.CustomDatedExchangeHandler.initializeExchangeRates('Expenses__c', 'Dated_Exchange_Rate__c', 'InvoiceDate', 'USD', ' isClosed=true and isWon=true ');
Understanding the Parameters
– `Expenses__c`: This is your target object. Replace it with the API name of the custom object you’re working with.
– `Dated_Exchange_Rate__c`: This field will be populated with the conversion rates. Replace it with the API name of the exchange rate field in your object.
– `InvoiceDate`: This field is used to determine the date for which the conversion rate should be applied. Replace it with the API name of the date field in your object.
– `USD`: This represents the corporate currency parameter. It’s used to determine the base currency against which conversions will be made. Replace ‘USD’ with your corporate currency code if different.
isClosed=true and isWon=true`:represents an additional filter that you probably may need to reduce the amount of records to initialize
- This process should manage less than 9000 records, ideally less than 4000
- Please notice this will massively update records, so you may turn off validations, flow, triggers and other logic tied to DML operations
- Try this in a sandbox before executing this in production
- If you need to update more than 9000 records, reach to our support team
- This API method is in beta functionality
After running this code, your existing records in the specified object should have their exchange rate fields initialized with the correct historical conversion rates. It’s a seamless process that ensures your financial data remains accurate and reflective of the real-world currency values.
For further inquiries or customized assistance, the team at support-at-axy7.com is always ready to help. Their expertise can guide you through any challenges or additional configurations you might need.