A typical practice when developing for CRM is to import a template org into your target environment then apply any custom schema changes (via solutions) over the top. You would then import any seed data that is required for the organization. The way to do this is a have a template organization in CRM, then when you need to create a new org, you simply take an SQL backup and restore as a new Organization name and use the Import Organization wizard in Deployment Manager, enter a new Display and Unique Database name and away you go!
Well, not quite as I found out.
I was querying the Organization Name in the Organization entity and on this occasion I got back the original org name and not the new name. The reasons for why I was doing this are for another time, but regardless I’d expect these two to be the same, they were not!
Taking a look at the Organization tables under the covers in both the Organization Database and MSCRM_CONFIG database there are differences between the two:
Figure: Importing dev-template as: dev-template-new-name
Now let’s query the Organization tables under the covers:
Figure: UniqueName and FriendlyName match
Now let’s take a look at the Organization table in the Organization’s Database:
Figure: GUID matches, but the Name field doesn’t reflect the *new* name
So what just happened here?
The Name field in the Organization table didn’t get updated with the new name. I found out after trial and error that this scenario would occur *IF* an organization is being imported to a *target* system where the organization with the original name doesn’t exist. A typical example of this is you have a development server that has your template
A typical example of this is you have a development server that has your template organizations, and you decide to create a new organization name based on the template on a *new* server say a test server. Unless dev-template is already present on the test server the Name field will keep the original organization name from the source. If dev-template is present on the test server then the Import Organization wizard works as expected with UniqueName and Name fields matching.
Unless dev-template is already present on the test server the Name field will keep the original organization name from the source. If dev-template is present on the test server then the Import Organization wizard works as expected with UniqueName and Name fields matching.
Seem like a bug to me ….
Verified on CRM 2016 .01 on-prem.