I'm trying to retrieve the metadata of all the objects. I retrieve all the objects using soapConnection.describeGlobal().getSobjects() and then insert them in my custom class Tables. This is then used in the Metadata class to obtain the metadata. However, I ran into this Warning message:
unpackaged/package.xml - Entity of type 'CustomObject' named 'CaseFeed' cannot be found ... unpackaged/package.xml - Can't retrieve non-customizable CustomObject named: HashtagDefinition
The corresponding Metadata retrieval code is:
public void retrieveZip(List<Table> tables) throws Exception { RetrieveRequest retrieveRequest = new RetrieveRequest(); retrieveRequest.setApiVersion(API_VERSION); setPackage(retrieveRequest, tables); AsyncResult asyncResult = metadataConnection.retrieve(retrieveRequest); RetrieveResult result = waitForRetrieveCompletion(asyncResult); switch (result.getStatus()) { case Succeeded: // Print out any warning messages StringBuilder stringBuilder = new StringBuilder(); if (result.getMessages() != null) { for (RetrieveMessage rm : result.getMessages()) stringBuilder.append(rm.getFileName() + " - " + rm.getProblem() + "\n"); } if (stringBuilder.length() > 0) LOGGER.warn("Retrieved warnings:\n" + stringBuilder); LOGGER.info("Writing results to zip file"); File resultsFile = new File(ZIP_FILE); FileOutputStream os = new FileOutputStream(resultsFile); try { os.write(result.getZipFile()); } finally { os.close(); } break; case Failed: throw new Exception(result.getErrorStatusCode() + " msg: " + result.getErrorMessage()); default: break; } } private void setPackage(RetrieveRequest request, List<Table> tables) { com.sforce.soap.metadata.Package p = null; List<PackageTypeMembers> listPackageTypes = new ArrayList<PackageTypeMembers>(); List<String> members = new LinkedList<String>(); for (Table tbl : tables) members.add(Utility.getsObjName(tbl.getName())); PackageTypeMembers packageTypes = new PackageTypeMembers(); packageTypes.setName("CustomObject"); packageTypes.setMembers(members.toArray(new String[members.size()])); listPackageTypes.add(packageTypes); p = new com.sforce.soap.metadata.Package(); PackageTypeMembers[] packageTypesArray = new PackageTypeMembers[listPackageTypes.size()]; p.setTypes(listPackageTypes.toArray(packageTypesArray)); p.setVersion(API_VERSION + ""); request.setUnpackaged(p); } Is there any way to retrieve the objects or do I have to resort to storing describeSObject() result for reference? The main reason is to make comparison between metadata during a period of time for detecting changes but I am not able to retrieve the metadata for a certain set of objects.