Certain entities that contain the activity roll-up feature, namely accounts, contacts and opportunities, are also equipped with a date filter that allows you to choose whether you want to see all the activities related to the record or just a selected subset. By default this is “Next 30 days”, but you also can choose between “Overdue” or “Next 12 months”, or just go for “All”. That’s the good news.
The bad news is that this piece of helpful functionality has remained uncustomizable throughout different Dynamics CRM versions. A lot of users were annoyed with especially the same filter in the associated history view, nowadays known as Closed Activities view in CRM 2011, which used to default to “Last 30 days” and hide away all but the most recent email threads, appointments and other information that you might have been searching for. You always had to change the filter manually to “All” to uncover the historical information about the relationship with the account or contact. However, this has changed now in the latest version and “All” has become the default filter (or should I say the filter is off by default).
That’s definitely a step towards the right direction. It’s not exactly what the response on Microsoft Connect suggests, which claims that “we’ve allowed a user to change the default filter for associated views in CRM 2011”. I’ve yet run into such a setting and neither has The Great Internet, unless Google is hiding such instructions or blog posts. It would be useful to be able to configure or remove filters that the end users don’t want to deal with, without having to resort to unsupported customizations.
Open vs. closed activities
History is one thing but it’s the future actions that matter the most. Until very recently, I’d say up until Update Rollup 2 of CRM 2011 the filter functionality in the open activities associated views used to be such that the default “Next 30 days” would also show any activity that was missing a due date. By default the due dates are not a required field and sometimes they are not that practical for the CRM users, as many things in the daily life of a modern information worker don’t have strict deadlines. Also, there’s no out-of-the-box functionality in Dynamics CRM to set default values for date fields either, so setting the exact due date for every task or phone call you enter on your task list may feel too bureaucratic. An activity with a missing date should be considered as “do this as soon as you can, given all the surrounding factors”, in my personal opinion.
In the current version of Update Rollup 5 the “Filter on” value is applied in such a way that it by default hides away all activities that don’t meet the “Next 30 days” criteria. If the due date is blank, the activities won’t show under the account/contact/opportunity. This may seem quite confusing to the user, since any new activity that he or she creates for the record will appear to “vanish” into thin air after clicking “Save and close”. In the My Activities view they will still appear on the top of the list, as null values in the Due Date column are sorted on top.
What’s even more confusing is that CRM 2011 introduces two different ways for users to navigate to related activities on the account form: the familiar associated view and the new subgrid. If you’ve been reading my blog, you’ll know that subgrids ain’t exactly what associated views used to be. They don’t contain the activity roll-up feature, so you won’t see those activities that are set regarding a child record of an account (for example, opportunities) instead of the account record directly. Just like another filter, except you can’t even change it.
How to change the default filter value
1. Create a new Web Resource of type Script (Jscript) and click the Text Editor button, then paste in the code from the above post.
2. Open the form customization window of the entity where you want to change the Activity view filter default. In this case we’ll do it on the account form. Select “Form properties” on the ribbon, click “Add” on the Form Libraries section and find the web resource you created in step 1.
3. Click the “Add” button on the Event Handlers section of the window to add a new entry for form OnLoad event. Select the library you created in step 2, enter SetView as the function field value and ‘Activities’, ‘All’, “crmGrid_Account_ActivityPointers_datefilter” in the parameters field.
4. Save & publish everything. Done! Just open an account form, navigate to associated activities view and witness the “Filter on” value being set to “All”.
When working with Contacts or Opportunities, just modify the third parameter value accordingly. If you want to set a different default value than “All”, the choices for the second parameter are ‘Overdue’, ‘Today’, ‘Tomorrow’, ‘NextXDays;7’, ‘NextXDays;30’, ‘NextXDays;90’, ‘NextXMonths;6’, ‘NextXMonths;12’. Once again, thanks to Andreas for providing us this script and the parameter values!
Just remember that it’s not a supported customization, so in case any of the view names change in future updates, you may need to modify the script. For instance, when I was testing on a system with Finnish base language, the view parameter was “crmGrid_Account_ActivityPointers_scheduledend” initially, but on an Update Rollup 5 system this appeared have changed globally to “crmGrid_Account_ActivityPointers_datefilter”.
If you’d rather see the Activity default filter being set to “All” in the Microsoft Dynamics CRM standard configuration, please go and vote on the related Microsoft Connect suggestion (Windows Live ID login required). Thanks.
Update 2013-01-13: With the cross-browser support delivered in Update Rollup 12, many of these unsupported scripts may break. Here’s a recent article on the awesome blog by the Magnetism team that talks about how to reset the filter to “All” in the new UR12+ environments. Still unsupported, but as the default filter remains unconfigurable and can cause important customer related tasks to go unnoticed, I think applying the customization is justifiable.
I must have missed a step along the way….Everything works fine when the Account form initially loads. The filter is changed to “All” as expected but when I try to save and close on the form i receive an error message (below). What could I be missing? Could it be related to the fact that I upgraded to Rollup 6?
Microsoft Dynamics CRM Error Report Contents
‘loadArea’ is undefined
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)
I tried doing this and when I loaded the form, it removed the ribbon. ??
How did I ever miss this one? Great trick, Jukka! I just followed those steps and it worked perfectly. For those of you that tried & got errors, did you copy the second piece of code from the linked article? (I copied the first snippet and noticed there wasn’t a SetView function, then went back and got the right one). Just a thought.
Anyway, Jukka, thanks!
Glad to hear this worked in your environment, Richard. For those who are facing problems with the script, I encourage you to also have a look at some of the other posts I linked to:
Although these examples didn’t work in the CRM organizations I tested with, it’s possible that there are some factors like the base language (mine’s in Finnish) that change the content of the page the script is trying to modify.
@Kevin and @Liz:
Change the Handler Properties into:
“Activities”, “All”, “crmGrid_Account_ActivityPointers_datefilter”
I had exact the same problem as you did!
Appreciate the time you (and Richard, and so many others!) take making this stuff available. It’s uber-valuable indeed.
Can this be applied in the CRM 2011 Online environment as well?
Yes, the script will also work with CRM Online, as it runs on the client side. If/when Microsoft changes the UI through future updates, the script may of course become nonfunctional and require an update or simply removal.
Great, thanks again Jukka!!
Thanks Rene….worked great.
Thanks for the script Jukka! Works beautifully!
I had ts request coming in last week, but to be honest I think I will go back to the client and say that this isn’t recommended. Reason is that this isn’t a supported customisation, so I am worried that this might “break” with future updates.
I would recommend consultants to try to compromise. Sometimes users have to compromise with limitations.
I want to change the default View “Open Activity associated View” to “Open Activity”.
Any Help please.
Which particular functionality do you want to achieve with the Open Activity view that you can’t get into Open Activity Associated View by customizing its columns?
there is a possibility to change the default view Open Activity associated view in other view, when I click on activities?
I’m not aware of the script required to change the default view used when looking at related activities on the account form. My question is, can’t you reach the exact same result by modifying the Open Activity Associated View to contain the same columns as Open Activities? As far as I know, the query criteria are identical in those views and both of them use the “Filter on (date)” and “Include related regarding records” filters.
In the open activity associated view we see e.g the scheduled and open appointment but in open activity view only open appointment.
My question is: can we per script, select open activity as default script?
I mean: can we per script, select open activity as default view?
You can edit the filter of the Activity Associated View and remove the criteria “status equals scheduled”, this should achieve the results you are looking for without any need to use unsupported scripts. Just access the Activity entity customizations, open the view, choose the filter definitions from the right side and perform the necessary modifications to the criteria used. If you set these to be equal as the criteria of Open Activities view, the results should be the same when looking at activities related to an account, contact or other records.
Is there a possible way in which one could Remove “Filter on” and “Include” options or make it hidden??
I haven’t come across such a script myself. I guess it would be technically possible to write a script that searches for the element on the page and hides it, but it’s of course unsupported and probably has an even higher risk of breaking once updates are released, compared to changing the filter default values.
I’m trying to apply this to the associated Case view within the Contact entity.
I don’t have the right parameter values. What I’m trying to do is change the default filter to All on the Case status.
I’ve tried variations of the following with no luck. Any suggestions:
‘Cases’, ‘All’, “crmGrid_Contact_CasePointers_statusfilter”
Totally stab in the dark but I thought I’d try. No luck though.
Damian, looking at the HTML for the page for Cases related to Contacts, the corresponding appGrid value would be “crmGrid_incident_customer_contacts_statecode”. I haven’t tested this myself, so I’m not sure if the same script logic can be applied here. You could use Fiddler to study the page source and try to determine what the view names and parameters should be changed to in order to achieve the results you want.
Jukka ¡ ¡
You’re my man
Thanks for this great post. I searched for hours for an explanation of this issue … and you did a great job
On opening a particular account or contact, all my users want ‘All Activities’ as default view instead of ‘Open Activity Associated View’ when they click Activities on the left navigation.
Is there any settings on Dynamics CRM online or I needed to apply a script?
Jon, I’m not aware of a supported way to select the default view that opens when navigating to the associated activities menu. However, if you would modify the name & filter criteria of the “Open Activity Associated View” to match that of the “All Activities View” & vice versa in the activity entity customizations, perhaps you could achieve the result you’re looking for.
I’m trying to apply this to the associated view Account-Invoices, and show as the default filter “All”, not “Active” Invoices, on the Account-Invoices relationship.
Is there a possibility I can modify the script/parameters in order to achieve my goal?
SL, I assume similar parameters could be applied for the invoice view as well, but I don’t have information of what those values would be. Studying the content of the rendered page via a tool like Fiddler might allow accessing the information. As mentioned, these would be unsupported modifications and they’d likely break with a future update/upgrade. Using subgrids on the account form (if you don’t need the “include related regarding records” feature) or building a report would be the supported approaches for customizing this area of the CRM application.
If anyone’s scripted this for invoices like SL was looking to do, please publish the code somewhere.
I’d very much appreciate it.