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
stunaitestunaite 

How To - currencyType doesn't support DML

Hi!

 

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

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_currencytype.htm

 

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

 

 

 

bob_buzzardbob_buzzard

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

stunaitestunaite

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?

bob_buzzardbob_buzzard

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

stunaitestunaite

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:

 

 

Error
Apex Generation FailedUnsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType

 

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

 

Thanks in advance


bob_buzzardbob_buzzard

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.