Changing the Default Activities Filter On View

When looking at Activities or History associated with an Account or Contact, the default Filter on value is 30 days, either the last 30 days for History, or the next 30 days for Activities. This can be easily changed by clicking on the drop down and selecting another value like 90 days or “All”. But often it’s desired to change this default. Not so easily done. What is being displayed is the Closed Activity Associated View (History) or Open Activity Associated View (Activities) found in the Activity entity customization. But to change the default, you must go into the Account or Contact entity to configure it. This is done (one way) by adding a client-side script to the OnLoad event to the form properties for these entities.


My friend and fellow CRM MVP Michael Höhne has written a couple of very detailed blogs describing how this is done, at least for the History listing. You can read Michael’s articles at http://www.stunnware.com/crm2/topic.aspx?id=js11 (CRM 3.0) and later at http://www.stunnware.com/crm2/topic.aspx?id=js33 (CRM 4.0). His articles focused on the History listings and I now needed the Activities (future) listings. For the History, the operable area is the “areaActivityHistory” and “areaActivityHistoryFrame”. For the Activities listing I tried simply taking the “History” off but that didn’t work. Following Michael’s guide, I opened the source code view of the Activities web page and found I needed to use “areaActivities” and “areaActivitiesFrame”. The other part of the puzzle was what value to use for the filter on field. At first I thought it was “scheduledstart” but that didn’t work. So I had a look at the view in the Activities entity editor. There I found that the view used the Due Date to filter on. the Due Date is actually called “scheduledend” in the schema. So I changed my code to use that and it worked! Below is the code, mostly copied from Michael’s but with my additions for Activities. Thanks Michael for your great articles and blog!


{
areaActivityHistoryFrame_OnReadyStateChange = function() {
    if (document.readyState==”complete”) {
        var frame = document.frames(“areaActivityHistoryFrame”);
        var filterCombo = frame.document.getElementById(“actualend”);
        filterCombo.value = “All”;
        filterCombo.FireOnChange();
    }
}


loadArea(‘areaActivityHistory’);
loadArea(‘areaForm’);
document.frames(“areaActivityHistoryFrame”).document.onreadystatechange =
areaActivityHistoryFrame_OnReadyStateChange;
}


{
areaActivitiesFrame_OnReadyStateChange = function() {
    if (document.readyState==”complete”) {
        var frame = document.frames(“areaActivitiesFrame”);
        var filterCombo = frame.document.getElementById(“scheduledend”);
        filterCombo.value = “All”;
        filterCombo.FireOnChange();
    }
}


loadArea(‘areaActivities’);
loadArea(‘areaForm’);
document.frames(“areaActivitiesFrame”).document.onreadystatechange =
areaActivitiesFrame_OnReadyStateChange;
}

VS on SBS

Recently I’ve been learning more about programming CRM. I’ve had no problems in the virtual environments of the training courseware. But I was trying to implement a simple sample program on my on CRM system using Visual Studio 2008 and it would consistently fail due to security exceptions. When I tried to run it, the debugger showed that Credentials in service.Credentials does not exist in the current context. Drilling down it showed the CallerId to be empty. Lots of other stuff was not getting properly picked up. I also saw a lot of System.Security.SecurityException errors. I Googled a bit and found some comments about ‘trusts’ and the code. I tried setting the Trust properties but that didn’t help. Actually it broke it worse. Then I remembered that when I start Visual Studio it gives me a warning about not trusting the location of my project files.


I run Small Business Server 2003, of course, and one of the nice features is that it implements My Documents Redirection. What this means is that the My Documents folder actually exists on the server and is referred to by a UNC (\\mySBS\Users\etc) and the files are synchronized to the local drive when going off-line. My VS projects by default use a folder in My Documents. I copied my primary source code and rebuilt the project in a folder directly on my local hard drive. This resolved my problem and the application worked the first time I tried.

Can’t Convert Lead

Had a call from a customer who was trying to convert a Lead in CRM  3.0. Whenever he’d try the Lead was properly deactivated, but no Account or Contact was created. He would receive the error below: It reads “The system could not log you on. This could be because your user record or the business unit you belong to has been deactivated in Microsoft CRM. For more information, contact your system administrator.” I just hate that last part :-)


clip_image002[4]


 


The user is the business owner so has the CEO etc security role with all rights duly intact. I decided to see what would happen if I created a new Lead and converted it. That worked fine. So I decided to see if there was anything about the Lead that wouldn’t convert that was causing the problem. That’s when I noticed that the Owner of the Lead was a user that was no longer with the company and who’s CRM user record had been disabled. I reassigned the Lead to the business owner who was trying to convert the record and was then able to convert with no problem. Guess it was trying to create the new Account and Contact records using the original owner and was unable to do so. Now the error makes sense.