Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2021 Release Wave 1Discover the latest updates and new features to Dynamics 365 planned April 2021 through September 2021.
Release overview guides and videos Release Plan | Preview 2021 Release Wave 1 Timeline
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Last week, I found the ultimate example of not knowing how to utilize the CRM object model. CRM 4.0 in this case:
for (var i = 0; i < crmForm.all.length; i++)
var crmField = crmForm.all[i];
if (crmField.title != null && crmField.title != 'undefined'
&& crmField.id != null && crmField.id != 'undefined'
&& crmField.id != '')
var fieldName = crmForm.all[i].id;
var eventType = crmForm.all.new_eventType.DataValue;
if (crmField.id.indexOf('new_name') == 0)
if (fieldName == 'new_name')
The idea here, and I am making an assumption, is to find the 'new_name' field then perform some action.
The first thing you will notice is that we are looping through all of the objects found in the CRM form. I checked and there were 2,607 objects in crmForm.all. That is a lot of looping.
Also, as you can see, there are lots and lots of checks to make sure we have the correct field. Once we have the correct field, we perform some specific actions.
This code is totally unnecessary and it actually delayed the loading of the form.
Here is all that was needed:
if (crmForm.all.new_name != null &&
crmForm.all.new_name.DataValue != null)
As you can see, this is much less code, it is easier to understand, and is much quicker.
If that fails, I would suggest visiting the Dynamics CRM Community Forums where the experts hang out.
Follow me on Twitter @mitchmilam. Read my new book: Dynamics Deep Dive: Security
Business Applications communities