You need to sign in to do that
Don't have an account?
Working with DatedConversionRate via the Web Services API
I've been tasked with automating updates to the Dated Exchange Rates; however, I can't seem to figure out how to work with the API to get what I need accomplished. I assume that since there's no create() call allowed on the object, that the update() call will do the backend work for me as far as capping off the old DatedConversionRate's NextStartDate based on the StartDate of the new DatedExchangeRate and then create a new record with the other information provided.
So I tried implementing the update() call, and I get a error response saying "A duplicate value was specified for field 'Id' in object 'DatedConversionRate', duplicate value '<Id value provided>' prior value '<Id value provided>'." Ok, so given the previous assumption based on allowing only update() calls on the object, maybe it doesn't require an Id in the call. Alas, "Id not specified in an update call."
At this point, I'm completely stumped. Any ideas?
Thanks!
Bump.
I'm still having an issue working with this object through the API. Does anyone have any experience or suggestions?
Create an Auth. Providers
Create a Named credentials.
Step by Step instruction is given in the below two URLs.
http://www.jitendrazaa.com/blog/salesforce/salesforce-to-salesforce-integration-using-named-credentials-in-just-5-lines-of-code/
https://www.jitendrazaa.com/blog/salesforce/login-to-salesforce-from-salesforce-using-authentication-provider/#more-4516
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');
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());
}