Adding color indicators to an entity record

April 9, 2009 at 4:33 pm | Posted in Microsoft Dynamics CRM 4.0 | Leave a comment


Yesterday I was preparing a demo  for a prospect. Another one of their stated requirements was:

If we wanted to flag a field could that record be in red? Such as customers past due and etc?

I tweaked my mind for a lot of time and come up with the following solution

 I added two custom attributes to the account entity:


  • Notification (nvarchar)
  • Payment Status (picklist)
  • Then I added this code to the form onLoad event for the account record, and to the onChange event for the payment status field.
  • UpdateDisplayBar();
    function UpdateDisplayBar()
      var notificationDisplay = document.getElementById("new_notification_d");
      var displayColor = "#EAF3FF";
      switch (crmForm.all.new_paymentstatus.DataValue)
        case "1":
          displayColor = "green";
        case "2":
          displayColor = "red";
      var displayBar = "<div style='background=" + displayColor + "'>&nbsp;</div>";
      notificationDisplay.innerHTML = displayBar;

    Now when you open an account record and update its payment status field, you’ll see a color indicator on the first tab (next to the Payment Status field). Green indicates they are “OK”, and red indicates “Overdue”. No color indicates that neither value has been selected. This is a sample example, but it gives a flavor of what’s possible within the user interface!





Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at
Entries and comments feeds.

%d bloggers like this: