I'm trying to reset a dev org by using this ant script.

Most part of the customisations added by default are removed. However, I'm not being able to retrieve custom fields on Opportunity, Account and other standard objects.

I'm using this to get customfields :


And this to get standard objects:


I've also tried:






How can I retrieve custom fields on standard object on ant migration tool?


As per the documentation the CustomField metadata type does not support wildcards sadly. You can access Custom Fields on Standard Objects by using the CustomObject metadata type as described here against specific Standard Objects. Then parse the .object file to build your destructiveChanges.xml file. Finally you can also use the sf:listMetadata task to download a list of all custom fields and then filter locally for Standard objects.


You might also be interested in an open-source undeploy Ant target published here, that wraps most of what i suspect your trying to develop up into a single Ant target. Sadly Salesforce do not yet give us a 'clean my org' task, so we build our own!

| improve this answer | |

Fully naming the fields works e.g.:

| improve this answer | |
  • Is there any way to make this more "generic" ? – Martin Borthiry Feb 10 '14 at 9:33
  • We have no examples with wildcards... – Keith C Feb 10 '14 at 9:35
  • 1
    But, how do you retrieve the customfields if you don't know the names? – Martin Borthiry Feb 10 '14 at 11:28
  • Sorry I didn't pick up the "reset a dev org" part of your question so I see where you are coming from now. You could write Java code that uses the meta-data API to find the field names and then wrap that in an Ant task that is called first and edits your package.xml. But just manually tracking the field names is simpler unless you are talking about hundreds of fields. – Keith C Feb 10 '14 at 11:46

If you want to extract all the custom field of say Accout object , then write atleast one custom field name of account object and then write * in the other member tag like this


This will extract all the custom field of account object.

And if you want to extract custom as well as standard field then go for this


Hope it helps

| improve this answer | |
  • 1
    I tried the first snippet, and only the specified field migrated. – bullcitydave Jan 25 '19 at 15:58

If you want to extract particular fields.Then use this


Using the Force.com Migration Tool Constructing a Project Manifest

| improve this answer | |

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.