Skip to content

I use Microsoft Dynamics CRM 4.0 for Outlook Client, so all my Activities with Due Dates create reminders in Outlook, which also go to my Windows Mobile device.  If Phone Calls, or other Activities are created with Due Date Times of 12:00 midnight, I get woken up by Outlook Reminders!

I now almost always set my Phone Calls with Due Date Times of 8:00 a.m. (and almost never 12:00 a.m.).  The problem is that, out-of-the-box, you have to set the Due Date manually, as you might expect.

So, eventually, I thought, I’ll have to customize this Phone Call Activity screen (form) to default to 8:00 a.m. instead of 12 midnight.  Only makes sense, right.

Well, I was surprised that it was difficult to find a way to do this.  I finally found an excellent blog with lots of great technical articles on MSCRM.  Full credit to Bill Owens with this link to the archive of the article in his “Bill Owens on Microsoft Dynamics CRM – Technical Version.”

Here’s the excerpt of the code I used that did the trick perfectly for me, thanks again to Bill’s blog:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
OnLoad
----------------------------------------
//check if the field exists on the form
if (crmForm.all.scheduledend != null) {
//save the value for future reference. Note that it is a global variable.
_previousValue = crmForm.all.scheduledend.DataValue;
}
OnChange of your date field
----------------------------------------
var dateField = crmForm.all.scheduledend;
var currentValue = dateField.DataValue;
//If the user changes the date field from null to a valid date, set the
//time portion to 8:00
if ((currentValue != null) && (_previousValue == null)) {
dateField.DataValue = new Date(currentValue.getYear(), currentValue.getMonth(), currentValue.getDate(), 8, 00);
}
//update _previousValue
_previousValue = currentValue;

Related Posts

Drop us a note

Please drop us a note via the form below with your comments or questions on this blog post; or if there is anything we can help you with.