function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Srinivas CSrinivas C 

when dated exchange rate of DatedConversionRate is saved, automatically create a record in company with the details of foreign exchange rate schedule record

Please Help ASAP
AbhishekAbhishek (Salesforce Developers) 
Hi,

You can call the REst API 

https://developer.salesforce.com/forums/?id=906F00000008xMkIAI
https://salesforce.stackexchange.com/questions/17380/update-conversionrate-in-test-class
https://th3silverlining.com/2009/11/23/dml-currently-not-allowed/​​​​​​​
https://salesforce.stackexchange.com/questions/175205/manage-datedconversionrate-using-apex?noredirect=1&lq=1​​​​​​​

HttpRequest feedRequest = new HttpRequest();
        feedRequest.setEndpoint('callout{Named_Credentials}/services/data/v36.0/sobjects/DatedConversionRate/'+ {idDatedConversion} +'?_HttpMethod=PATCH');
        feedRequest.setBody('{ "ConversionRate" : '+ {rate }+' }');//Rate to be updated            
        feedRequest.setHeader('Content-Type', 'application/json');
        
        feedRequest.setMethod('POST');
        Http http = new Http();
        try
        {
            if(!Test.isRunningTest()){
                HTTPResponse feedResponse = http.send(feedRequest);
            }
        }         
        catch(Exception ex)
        {
            System.debug('exception in BatchCurrecnyCovnersionUpdate.execute method '+ex.getMessage());
        }

For your reference,

https://success.salesforce.com/answers?id=9063A000000iWjxQAE

https://success.salesforce.com/answers?id=90630000000gzoCAAQ

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

​​​​​​​Thanks.