Search code examples
configurationdynamics-crm-2011dynamics-crmdynamics-crm-online

How to configure Default Organization in on-premise Dynamics CRM 2013?


I have an online CRM and my local on-premice CRM installtion. When I deploy my solution in the online CRM I build my Server URL for accessing the REST services of the CRM like this:

return string.Format("{0}/XRMServices/2011/OrganizationData.svc", LocalServerHost);

When I deploy that on the on-premise CRM this will not work. Instead I have to add the organization name to the URL, like this:

return string.Format("{0}/<MyOrganization>/XRMServices/2011/OrganizationData.svc", LocalServerHost);

I want to be able to deploy my application to both, on-premise and online CRMs without changing the code everytime. How can I configure my on-premise CRM to use a default organization?

Cheers, Arne


Solution

  • The main issue is that CRM Online uses the IFD configuration, which produces a URL like this:

    https://<orgname>.crm.dynamics.com
    

    But On-Premise (without IFD) uses a URL that looks like this:

    http://<servername>/<orgname>/...
    

    The easiest way to fix your problem is probably to configure IFD on your On-Premise install so you will get a URL that looks like CRM Online. Then your environments will match and your first line of code should work on both.

    Configuring IFD is not for the faint of heart, so another option (although somewhat ugly) would be to add a condition to your javascript that looks for "crm.dynamics.com" in the LocalServerHost variable. If it is there, use the Online URL format, otherwise use the On-Premise URL format.