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

How To - currencyType doesn't support DML



I am trying to update currencyType and datsObject with dayly values from a webservice.


Unfortunately currencyType is one of those Standard Objects that don't support DML calls. However looking at CurrencyType definition


we found some supported calls (core calls) like create(), update(), delete() and so on.


Can I use this calls inside my apex code? If so, what is the syntax. An example we be very wellcome. All examples I found using this calls are in client applications so quite unesuful for my case.


Thanks in advance





You can't use web service API calls from Apex code, you would need to write a web service client to use that API.


So, I have to create a web service and then call it  inside the same organization?


Like exporting the service as WSDL, importing the same WSDL into the same organization and then using Apex to access the object via core calls?


That's the only way you'll be able to do it if the sobject doesn't support DML I'm afraid.


Hi Bob,


I am trying to follow this sequence:


1 - Creating a WSDL via setup > develop > api > enterprise WSDL (should I choose another WSDL type?) and saving it on my pc with default name "wsdl.jsp.xml"


2 -Creating Apex Classes via importing that file. Setup > delevop > apex classes > generate from wsdl. "Parsing WSDL" gives no errors but when I press create "Generate Apex Code" gives me:



Apex Generation FailedUnsupported schema type: {}anyType


Can you validate if this makes any sense? If so, how can by pass this error on creating apex classes?


Thanks in advance


I can see what you are trying to do, but that won't work I'm afraid.  You can't call web services in Salesforce from within Salesforce.  You'll need to create an external client that accesses the web services API.