2

When I try to download apex classes or triggers via the ant tool, I get the following error:

INVALID_TYPE: Cannot use: ApexClass in this organization

This was working yesterday, I don't think anything major has changed since then.

I have an Unlimited Org, so this should not be a limitation of that.

This is the simplest build xml I can get to fail:

<project basedir="." xmlns:sf="antlib:com.salesforce">
    <property file="build.properties"/>
    <property environment="env"/>

    <condition property="sf.username" value=""> <not> <isset property="sf.username"/> </not> </condition>
    <condition property="sf.password" value=""> <not> <isset property="sf.password"/> </not> </condition>
    <condition property="sf.sessionId" value=""> <not> <isset property="sf.sessionId"/> </not> </condition>


    <target name="bulk">
      <sf:bulkRetrieve username="${sf.username}" password="${sf.password}" sessionId="${sf.sessionId}" 
        serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" metadataType="ApexClass" 
        retrieveTarget="bulkRetrieve\metadata"/>
    </target>
</project>
2
  • 1
    Is this a production org or sandbox org? Jul 8 '16 at 18:40
  • This is a sandbox environment Jul 8 '16 at 19:10
5

It seems there was an Author Apex permission I needed, which had somehow gotten unset at some point.

Adding this permission to my profile has resolved the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.