1

I only want to deploy custom fields of an object from One Org to another Org using apex class.

Note: Both the orgs are not interlinked with each other.

Is it possible? If yes how?

closed as off-topic by Adrian Larson, Ratan Paul, Eric, Vigneshwaran G, Mohith Shrivastava Aug 29 '16 at 14:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Adrian Larson, Ratan Paul, Vigneshwaran G, Mohith Shrivastava
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Is there any particular reason you want to deploy using apex, rather than the provided tools? – Nick Cook Aug 29 '16 at 8:13
1

The Metadata API makes use of web services and so can be called from Apex and used to do what you ask. See the Apex Wrapper Salesforce Metadata API for code and additional information and examples.

However, there are simpler ways to get what you want done (if you relax the need for this to be done via an Apex class), including the platform's built in Change Sets an the Ant-based Migration Tools.

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