1

When I'm trying to delete Custom Objects and Custom Fields via metadata Api with deleteMetadata(), they not fully deleting, but moving to Deleted Objects or Deleted Fields. Is there any way to mass erase they NOT using destructiveChandes with purgeOnDelete?

MetadataConnection connection = MetadataLoginUtil.login(); // like example on SFDC    
DeleteResult[] results = connection.deleteMetadata("CustomObject", "COName");

and so on...

1 Answer 1

1

I'm not seeing anything in the docs about being able to do a hard delete with the deleteMetadata call. I think the only way to do it is via destructiveChanges deployed with purgeOnDelete.

I know there is not an API to hard delete something that has been soft deleted as I was just looking for one a few weeks ago to work around a platform bug which has now been fixed.

Is there a particular reason to not use a deploy with purgeOnDelete? Constructing a destructiveChanges.xml file is pretty easy to do.

3
  • Yes, constructing a destructiveChanges.xml file is easy, but not when you try to clean your DE org and trying to deleting mass of CustomFields and CustomObjects, that linked by huge number of relations between each others. And you need to delete them in sequence started from leafs and go down by tree of relations. Commented Aug 11, 2014 at 11:04
  • I'm not saying it's not possible to run into dependency issues, but we've been dynamically constructing our destructiveChanges.xml file on every build (3000+ builds) over the last 9 months without dependency issues. Commented Aug 11, 2014 at 12:47
  • Oops, forgot enter can't be used in comments... The destructiveChanges.xml deployment is supposed to resolve all dependencies in one delete operation and thus should make your situation far easier than trying to use deleteMetadata where you do have resolve the dependencies on an individual basis. If you want examples of how to construct it, check out our build.xml file and the scripts it uses in the lib directory for examples: github.com/SalesforceFoundation/Cumulus/blob/dev/build.xml#L421 Commented Aug 11, 2014 at 12:49

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.