Tip #639: I shall call him Squishy

I shall call him SquishySelecting a good name for an organization in CRM On-premises has always been a challenge especially when you automate provisioning of your CRM organizations. At least one would hope that the chosen name would stick.

However, our special correspondent Mehmet “Sputnik” Ozdemir reports from the trenches that organizationid and name fields in the organization entity will contain the old values if the organization you’re importing did not exist on that server before.

One more reason to, instead of poking the entities directly, use RetrieveCurrentOrganizationRequest, available since CRM 2015, to discover details of the current organization:

var details = service
    .Execute<RetrieveCurrentOrganizationResponse>
    (new RetrieveCurrentOrganizationRequest());

Console.WriteLine(details.Detail.OrganizationId);
Console.WriteLine(details.Detail.OrganizationVersion);
Console.WriteLine(details.Detail.UniqueName);
Console.WriteLine(details.Detail.FriendlyName);
Console.WriteLine(details.Detail.UrlName);
 
Share on FacebookTweet about this on TwitterShare on Google+

Leave a Reply

Your email address will not be published. Required fields are marked *