Copying metadata and code from one Production org to another

  • How do I copy(for want of a better word) metadata (i.e. Objects, Workflows, Validation rule etc), and code (Apex, Visualforce, Triggers) from one Production org to another production org?

    Is this even possible? I know that Change Sets won't help here since they work only within an org.

    Thanks!

    To help those that come after: This question refers to a one-time deploy if you read through all of the answers below.

  • You can use the Force.com IDE to do this. Follow the download and installation instructions here: Force.com IDE Installation

    Once the Force.com IDE is installed, create a new project and provide the source org's login information and choose all meta-data objects you want to deploy to another org. Once they've all be downloaded into your project, right-click on the project and select "Force.com->Deploy to Server" and the tool will walk you through the process with a wizard.

    Thanks @E.J.Wilburn ! I have used Force.com IDE to deploy changes from a sandbox to a prod org. But I have never used it deploy code and metadata from one prod org to another. Lets say I have the eclipse project connected to Prod Org 1, can I then just deploy it to Prod Org 2 using the deploy wizard?

    Hi @Anup yes you can deploy the metadata and code in that way. The wizard asks for the login details of the target org. It doesn't have to be the same as the one linked to the project.

    Yes. It will work as it does when deploying from sandbox to production. You won't be able to edit any of the components you can't edit via the web UI though, they'll be in read-only mode and saving any changes will result in an error.

    note, if you have selected Profiles in the source project that makes deployment VERY hard because those Profile settings even if you don't select the Profiles to be deployed carry over. e.g. you have a field on a Account that is FLS private for all except a Profile *CustomAdmin...when you try to deploy that custom field it will fail because the destination org doesn't have *CustomAdmin profile. My suggestion - have your project just be config/code/report, etc minus profiles, then in your destination org re-do security as you see fit, or bring over the Profiles too which is harder, but doable.

    I actually disagree about not pulling in Profiles. They key is to pull the widest possible set of metadata (pull in everything). This helps make the profiles consistent and complete.

    Thanks for this answer, I am getting lots of problems about "Invalid Type" when cls files are referencing certain objects. I made sure that all the cls files were being selected in the deployment wizard. I must be missing something?

    It appears that these invalid types are referencing a namespace that must be different under the new org.

    If youre going to use force.com IDE, It doesnt work if the database is Managed. I tried to copy custom fields from a managed database. unless im doing something wrong... maybe I am. Just an FYI.

    You're talking about managed fields/objects from a managed package and no those can't be copied via any means. You have to have the managed package installed in both orgs. If it's a production org with the package installed it will automatically be installed in any sandbox when that sandbox is refreshed. Otherwise you'll need to install the package in both orgs.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM

Tags used