+ Start a Discussion

automatic update field for money currency conversion

I've seen a few posts concerning this subject, but is there an alternate way to fetch a conversion rate for money on an web site and save it in a variable to use it in reports?


I'm really interested to know if someone knows a good or better method to this or something really close,



Create a Connected App
Create an Auth. Providers
Create a Named credentials.
Step by Step instruction is given in the below two URLs.

Once the above configuration is done, please use the below piece of code to update the Managed Dated Currency.

        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');
        Http http = new Http();
                HTTPResponse feedResponse = http.send(feedRequest);
        catch(Exception ex)
            System.debug('exception in BatchCurrecnyCovnersionUpdate.execute method '+ex.getMessage());