Dynamics CRM in the Field

Information from the Microsoft Dynamics CRM PFE team working in the field

Azure Mobile + JavaScript + WebResources = Easy Editing of OrgDBOrgSettings in Dynamics CRM 2011!

Azure Mobile + JavaScript + WebResources = Easy Editing of OrgDBOrgSettings in Dynamics CRM 2011!

Rate This
  • Comments 0

Project and Download URL: http://orgDbOrgSettings.codeplex.com

What are orgDbOrgSettings you ask? They work similar to registry settings but they’re stored in the CRM database instead of in a given servers registry.  OrgDbOrgSettings control behaviors and various other CRM system settings and have been added over various releases and will continue to be added as needed.  And customers may edit these when they want to optimize/tailor the experience based on specific requirements. As you may know, there is an existing command line tool referred to in the OrgDbOrgSettings KB: KB2691237, this existing command line tool can be used for all types of CRM Customers but requires extensive configuration.  If you’ve run the command line tool you’ll understand the desire for something having something with far fewer configuration requirements.  

The idea for the project came several months ago when I was prototyping various uses of CRM’s OData/REST endpoint and discovered a plethora of accessible entities that could be very useful including the “Organization” entity.  Using this prototype I added on more sample code and eventually had an HTML webresource that can be published CRM for editing OrgDbOrgSettings.  A few folks from the CRM Support team tested and gave feedback along with a few partners, after making some changes based on their feedback I now have something I consider “ready for use” and this is what it looks like:

 image_thumb4

The idea was to make it straightforward and simple given the time I had.  This project has taken place over many weeks and includes many different samples and concepts and I’ll admin the code isn’t as “neat” and clean as I would like it to be but, frankly speaking, I’m not sure if code is ever clean or neat enough to share with the “community” at large Smile.  In either case the time has come to get this out and let folks use it and give feedback.  First, I want to say that you should only really edit these settings when you have a specific reason to do so – a couple of the more advanced settings should also be tested or set with guidance of other KB articles or support engineers.  I can cover these settings and why you should be using them instead of the registry in a later blog post if there’s interest, but for now I’m sure you’re thinking: how exactly does it work?  And where can I get it?  You can download it here, and for those who are curious read on to learn more.

Technical Details: The utility is simple in concept, there’s an XML file describing all the various orgDbOrgSettings and there’s an HTML file that uses JavaScript (along with JSON & JQuery) to parse the information and display it in a table.  When you initially add any given setting to your organization, it will insert the setting with it’s default value into the “orgDBOrgSettings” attribute on the “Organization” entity using CRM’s REST endpoint.  And when you edit a setting value it will update that same value via the REST endpoint.  If you look at the HTML page source you’ll find a thousand or so lines of HTML & Javascript, the majority of which is: validation helpers, formatting helpers, custom “classes”, and prototype methods to parse and handle BuildNumbers and orgSettings as they are read from the settings XML file and from CRM.

But there’s more, if you’re accessing this page from a modern browser and computer connected to the internet, it will also call out to AzureMobile services and retrieve the latest build version number. When I publish an update you’ll get a message in the settings editor from AzureMobile telling you there’s an updated version along with a URL. It’s important to keep this updated as new settings get released in update rollups.  To update in the utility, click the link to download and save the solution, click another link to launch CRM’s import wizard, import the solution, and press F5 to refresh the solution window and you’ll have the latest update with the newest settings! For those curious about how the caching and callbacks to Azure work, the editor will only call back to Azure once every 7 days.  This timeframe is stored using HTML5 localStorage and will reset under a couple different conditions (localStorage is available in all modern browsers and IE8, more info on localStorage can be found here) .  And for those concerned about the amount of data stored there, I’m currently storing three values, all of which contain a very small amount of string data. 

I have had a lot questions recently around extending CRM interacting with other services (odata/rest) residing in different domains – these requests and communications are commonly referred to as a Cross Domain Requests or XDR’s.  Generally, the answer to any cross domain communication from the browser is to use Cross Origin Resource Sharing (CORS) along with XDR’s (XDR’s are partially supported in IE8, more standardized partial support is in IE9, and full support in IE10).  And if you’re you look for a very easy way to create a REST endpoint that supports CORS for XDR’s - AzureMobile supports the configuration right in the dashboard and thus allows JavaScript to call back into Azure using OData without having to sacrifice browser security – reducing browser security settings should not be taken lightly nor done as a ‘simple' solution or ‘workaround’.  If you’re working on a project and are finding the need to add sites to the trusted zone so you can Disable XDR checks – please stop and investigate the use of CORS, your clients and users will thank you for the reduced complexity and increased security of the solution.

I hope you find the Org Settings Utility to be useful and it should save you some time as your configuring, implementing , and deploying CRM.  And if you’re building mobile apps you should look at leverage AzureMobile.  As always I appreciate the constructive feedback of the community and look forward to hearing from you!

Sean McNellis

 

PS: For those who are interested in how AzureMobile works, setting up the service and connecting via JavaScript for this project took no more than 45 minutes and if you’re looking for easy support of CORS/XDR’s, writing a mobile app for Windows8, Windows Phone8, iOS, or Android you absolutely must look at Azure Mobile! Oh, as if this wasn’t enough – AzureMobile also natively supports logins for MicrosoftID, Facebook, Google, and more to come.  I certainly intend to write a blog post about my experience with this as well as provide some kind of blog video / podcast that will cover how I used Azure Mobile as well as show off some of the other very cool and easy to use features for mobile apps like Identity, Push Notifications, etc – I was amazed at the functionality as well as how easy it is to implement (Azure Mobile Services and the AzureMobile Preview Signup URL). Also, what I just referred to only scratches the surface of what you can do – for some interactive videos check these out: http://channel9.msdn.com/Series/Windows-Azure-Mobile-Services

Leave a Comment
  • Please add 3 and 8 and type the answer here:
  • Post