function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Renato OliveiraRenato Oliveira 

Can't copy orgs with Migration Tool

I'm trying to implement CI for the company I work for, and having troubles with the Migration Tool. I got a package.xml with all the metadata information from my origin org, and I'm trying to deploy it to a new, completely clean org. However, I'm getting a lot of errors (like 667 errors!) while deploying to the clean org. Some of them include:
 
[sf:deploy] 19.  objects/Trabalho__c.object (Trabalho__c.SBF_Contecnica1_Trabalho) -- Error: This View Unique Name already exists or has been previously used.  Please choose a different name. (line 1027, column 16)
[sf:deploy] 72.  reports/Financeiro_Plenos_ADM/Emprestimos.report -- Error: filterlanguage: Invalid value specified: 64.
[sf:deploy] 115.  reports/Plenos_ADM_e_ENG/Encargos_Sociais.report -- Error: filterlanguage: Invalid value specified: 64.
[sf:deploy] 238.  workflows/Apontamento__c.workflow (Apontamento__c.SE_Envio_do_email_do_RDA) -- Error: In field: recipient - no User named name@company found (line 48, column 13)
[sf:deploy] 336.  classes/Teste_Trabalho_AtualizaSugestaoCrea.cls -- Error: Dependent class is invalid and needs recompilation:
    build   28-Apr-2015 16:44:16
[sf:deploy]       Teste_Cria_Objetos: line 7, column 55: Invalid field cnpj__c for SObject Account (line 5, column 5)
[sf:deploy] 414.  profiles/SolutionManager.profile -- Warning: You can't edit tab settings for SocialPersona, as it's not a valid tab.
[sf:deploy] 443.  email/unfiled$public/Informacoes_do_Diario_clonado.email -- Error: Apex class 'doDisplayController' does not exist



What I find odd about this is that some errors, like the 443 (the last one above), tell that a class does not exist, while the same class is specified in the package.xml in the retrieve and deploy methods.

Has anyone ever experienced something like this before? What can I do to successfully copy a whole Salesforce org?

PS:

I have access to the sandbox, and other clean orgs. I don't have access to the original org.
Leslie  KismartoniLeslie Kismartoni
  1. Regarding the dependency errors: When there is a problem with something up the chain, it'll throw errors downstream... 
  2. I use CodeShip to handle CI environments. I've found that a limited migration of just necessary apex code, classes, triggers, etc. seemed to work best. I think each use case will be different.
  3. A possible workaround is to have Salesforce enable TrialForce (you might need to be a partner/ISV for them to do this), then you'd be able to have them cut a copy of the org and use a form to distribute copies. The downside to this, other than contractual stuff, is that there is usually a lag in getting a copy of an org prepared, pushed through the trialforce process, etc... Giving props to CodeScience for coming up with a solution here: http://codescience.com/devops/a-working-example-of-continuous-integration-for-salesforce-isvs/ (though it didn't work in my case...)
This is tough stuff - SFDC development still kinda lags in the whole CI aspect - ping me if I can help brainstorm some ideas... 







 
Renato OliveiraRenato Oliveira
Leslie, thank you for your answer. At the moment, the company is using Atlassian's Bamboo for automating the building process. My issue here is mostly with package.xml, I believe.

I don't think I'm getting the idea behind the .xml file. Even though I'm using something like
 
...
<types>
        <members>*</members>
        <name>ApexClass</name>
</types>
...

inside of the file, it doesn't seem to be getting every class (as pointed by error 443).

I honestly don't get why this must be such a painful process. I just want to have a copy of the sandbox for each develop to work in their own feature, then be able to push the changes (via git) to a repository that synchronizes with the sandbox instance. This synchronizing part we got working in 8 days (with poor documentation on how to do it without Atlassian's Stash and Jira). Now, what's blocking our path is just this data migration (objects, profiles, triggers, classes, layouts, etc).

To generate the package.xml, I'm using MavensMate with Sublime Text. When creating a new project, I certify that I'm selecting all metadata to export, and the retrieval process is smooth. The problem is when deploying to an empty org. The errors start to appear, saying that "x class does not exist", and I'm like "Holy guacamole! Ant is a genius! Like I didn't knew this before." (noticed the infinite amount of sarcasm?)

Salesforce really should have a dedicated section for migration.

Anyway, any ideas on how to proceed from here? How can I generate a package.xml to cover every single metadata file on my source org, so I can just deploy to a new, empty org?
Leslie  KismartoniLeslie Kismartoni
Here's a package.xml that I use that just handles basic things that a developer would touch: ApexClasses, Pages, Static Resources... 
 
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>
    <version>31.0</version>
</Package>

A lot of my objects are in a managed package, so I can't really migrate them (need to update/install a package)
 
JoThomasJoThomas
HI  Oliveira , 

we are also facing the same problem now . we are copying from one org to new org and we are getting around 600plus errors . 
what is the path you followed for migrating from org to another org 
Nagen Sahu 6Nagen Sahu 6
This app is pretty useful for generating a comprehensive package.xml https://packagebuilder.herokuapp.com/

You can then start removing things from the package.xml and come down to the things you actually need