0

I am trying to move the metadata of my managed package to my local directory.For this i am using ANT tool.Namespace of the package is "gii".Apex class which i am accessig is searchCriteria.While trying to get the file i am getting the error "Entity of type 'ApexClass' name 'gii_searchCriteria' cannot be found".

I am trying the following in my package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>gii_searchCriteria</members>
        <name>ApexClass</name>
    </types>
    <version>36.0</version>
</Package>

Can i not import the managed package to my local system??

9
  • I dont know whats the issue.I am able to retreive the Custom object of managed package by directing using the API name but getting error while retrieving custom fields,pages etc
    – Samir
    Mar 9, 2016 at 14:33
  • Try the wildcard <members>*</members> for ApexClass and see what you get.
    – Keith C
    Mar 9, 2016 at 14:49
  • i get all the apex class excluding which are there in the installed package
    – Samir
    Mar 9, 2016 at 14:58
  • Including searchCriteria.cls?
    – Keith C
    Mar 9, 2016 at 16:06
  • excluding that..nothing is retreiving from managed package except custom objects
    – Samir
    Mar 10, 2016 at 8:36

3 Answers 3

2

If you are accessing the org that your managed package is created in, then the namespace prefix does not need to be supplied in package.xml so this:

<members>searchCriteria</members>

should work.

Also note that (in other circumstances) a class is qualified by the namespace using a dot e.g.:

gii.searchCriteria

and an SObject or SObject field by a double underscore e.g.:

gii__MyCustomObject__c

(If you are accessing an org that the managed package is installed into, you will not be able to access the source code of any class that is in the managed package as that is hidden.)

2
  • Thanks Keith .I tries <members>searchCriteria</members> but i keep getting the same error
    – Samir
    Mar 9, 2016 at 12:34
  • @Samir Apart from double checking that the Ant tooling is accessing the correct org and that the class name in that org is exactly searchCriteria I'm out of ideas...
    – Keith C
    Mar 9, 2016 at 12:40
0

You say you're manually editing your package.xml manifest, but you also mention you're trying to pull down (i.e., ant retrievePkg) which is a bit contradictory. Local changes to your package.xml manifest would have no effect when executing the retrievePkg task.

If you go into Setup, Build > Create > Packages and view your package, do you see your Apex Class? If not, add it via the Add button and then run ant retrievePkg.

2
  • when i open my installed package , i can see the apex class with all the other components as well but still i am not able to retrieve that class to my local directory
    – Samir
    Mar 9, 2016 at 13:54
  • Something doesn't add up... You're sure the class name in package.xml matches your actual class name? Given the information you've provided, I'd expect to see searchCriteria.cls (that declares public class searchCriteria) and searchCriteria.cls-meta.xml files. Mar 9, 2016 at 14:10
-1

I came to know that we can retrieve the Custom object of managed package by directly using the API name. But its not possible to retrieve apex class/VF pages or anything.WE can take the bake up of the whole data structure of Managed Package but not more than that.Hope this will help someone.

If someone has some other explanation or has something to add , Please feel free to post.

You must log in to answer this question.

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