1

I am trying to get a list of all metadata objects with the given name. However, the code below fails:

connection.readMetadata("ApexClass", new String[] {"SampleDeployClass"});

with this error:

Exception in thread "main" com.sforce.ws.SoapFaultException: INVALID_TYPE: This type of metadata is not available for this organization

Using connection.listMetadata() I am able to confirm that SampleDeployClass exists. I'm using a DE org, and the user has the Modify all data permission.

Is this something expexted (couldn't find it in the docs)? If yes, how am I able to confirm that a set of metadata objects already exists (other than retrieve())?

UPDATE 1:

Seems like renameMetadata() doesn't work with ApexClasses either. Is it maybe a restriction in the API which prevents anyone from changing Apex code?

UPDATE 2:

Nor does it work using JSForce, so it's not something related to the client code.

6
  • 1
    Did you find an answer to this? I've been banging my head against this as well.
    – Rockdocta
    Commented Jan 24, 2015 at 4:01
  • @Rockdocta Nope, no answer here. I ended up using retrieve() as a workaround, but what I initially wanted to accomplish, I haven't. Commented Jan 25, 2015 at 6:48
  • Can you post here what your retrieve code looks like?
    – Rockdocta
    Commented Jan 25, 2015 at 12:14
  • 1
    Basically, it's this: gist.github.com/hariso/… Commented Jan 28, 2015 at 14:08
  • I've been facing same kind of error, I'm trying to ReadMetadata only (ApexTrigger), but it return same error even in DE or Sandbox org. Does anyone know why? I'm not trying to update Trigger, I am only trying to read them.
    – VarunC
    Commented May 13, 2015 at 12:33

1 Answer 1

1

I think you need to use Tooling API instead.

I'm using JSForce for this.

connection.tooling.sobject('ApexClass').retrieve('01p7R000007Axk8QAC', (error, result) => {
   
});

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .