Knowledge found and lost while working with Microsoft Dynamics CRM
RSS icon Home icon
  • Verifying Form Context Before Invoking JavaScript Code

    Posted on March 19th, 2007 mitch Print Print 1 comment

    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.

    Quick Create Backgrounder

    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:

     

     

    The Problem I Found

    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:

     

    Ensuring a Smooth User Experience

    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.

    Customization, Dynamics CRM
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
    3,864 views
  • Spring has sprung

    Posted on March 19th, 2007 mitch Print Print No comments

    So I was at the MVP Summit in Seattle last week.  Naturally, I washed my truck the day before I leave town and again, naturally, I park it outside under an Oak tree.

    I have five Oak trees at my house and since it is Spring and Momma Trees and Daddy Trees are doing what Momma and Daddy trees do to make baby trees.

    This means my newly washed truck is both sticky and is covered with a fine layer of green coloring.

    At least my truck was all decked out for St. Patty's Day.  Ugly, but in the spirit of the Irish, nonetheless.

    Meanderings
    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
    1,207 views