19 Mar
Posted by: mitch in: Customization, Dynamics CRM
I was testing a callout-based solution for customer this afternoon when I ran into something very interesting when adding a new Contact ( to the Primary Contact Attribute of the Account ), using the Quick Create feature.
If you've never noticed, several CRM Lookup dialogs have a New button that allow you to create new records on the fly without having to change your context to that particular record type and selecting the New button. CRM will display a dialog that contains all of the Business Required and Business Recommended Attributes for you to complete, as shown below:
It turns out that since this is my main development server, I have all types of strange configurations loaded, including something that uses the OriginatingLeadID attribute in the Form OnLoad event. Unfortunately, since the OriginatingLeadID is not a Required or Recommended Attribute, it was not displayed on the Quick Create Form and therefore unavailable to the OnLoad event. This produced the following Error:
The easiest method for ensuring your OnLoad JavaScript functions as expected, is to verify the CRM Form Type using code similar to the following:
// Perform this work only on Create
if (crmForm.FormType == 1) { // do the work here }
CRM Defines the following form types:
Undefined Form Type = 0
Create Form = 1
Update Form = 2
Read Only Form = 3
Disabled Form = 4
Quick Create Form = 5
Bulk Edit Form = 6
For more information on FormTypes and other CRM Form Properties, visit this link.
One Response
Mitch Milam’s Microsoft Discussions » Blog Archive » Note regarding crmForm.FormType
14|Sep|2007 1[...] http://blogs.infinite-x.net/2007/03/19/verifying-form-context-before-invoking-javascript-code/ [...]
Leave a reply