Activity view default filter, missing due dates and how to modify the filter

26 comments

Posted on 23rd January 2012 by Jukka Niiranen in Annoyances |Tips

, , , , , , ,

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

There’s been numerous blog posts written on the topic of setting the filter defaults on CRM 4.0, but I was initially a bit surprised I couldn’t find a working piece of Javascript to achieve this on CRM 2011. Examples like this, this or this didn’t seem to be working for me, but luckily I ran into this post on the Microsoft Dynamics CRM German forum by Andreas Buchinger. To save you the trouble of Google Translate (well, it’s not much trouble at all when using Chrome’s built-in translation toolbar), here’s a walk through of the steps needed.

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.

26 Comments
  1. crmevan says:

    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?

    Thanks
    Kevin

    Microsoft Dynamics CRM Error Report Contents

    1.0

    ‘loadArea’ is undefined
    27
    /%7B634635528430000000%7D/WebResources/inf_ActivityViewsFilterDefault
    /userdefined/edit.aspx?_gridType=1&etc=1&id=%7b321CAADA-6747-E111-9EBC-000C2971B564%7d&pagemode=iframe&preloadcache=1327956290546&rskey=795196721

    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)
    en-us
    en-us
    en-us
    1920×1080
    Web
    2012-01-30T15:44:51

    1033
    1033
    1033
    1033
    {E55A3657-DE45-E111-8362-000C2971B564}
    {59758378-DE45-E111-8362-000C2971B564}
    5.0.9690.1992

    30th January 2012 at 22:55

  2. Liz says:

    I tried doing this and when I loaded the form, it removed the ribbon. ??

    1st February 2012 at 22:04

  3. Richard Knudson says:

    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!

    Richard

    11th February 2012 at 01:04

  4. Jukka Niiranen says:

    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:

    http://social.microsoft.com/Forums/en/crm/thread/63183622-39cb-4b43-acf0-cef5be6041b8
    http://thetaoofcrm.com/2011/11/08/default-associated-view-to-all/
    http://deepscrm.blogspot.com/2011/12/crm-2011-changing-default-activities.html

    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.

    12th February 2012 at 10:28

  5. Rene says:

    @Kevin and @Liz:

    Change the Handler Properties into:

    “Activities”, “All”, “crmGrid_Account_ActivityPointers_datefilter”

    I had exact the same problem as you did!

    Regards,

    René

    18th February 2012 at 10:09

  6. Malcolm McAuley says:

    Hi Jukka,
    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?

    Kind regards,
    Malcolm

    12th March 2012 at 16:30

  7. Jukka Niiranen says:

    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.

    13th March 2012 at 08:52

  8. Malcolm McAuley says:

    Great, thanks again Jukka!!

    31st March 2012 at 05:33

  9. Kevin Wydra says:

    Thanks Rene….worked great.

    5th April 2012 at 18:51

  10. pmdci says:

    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.

    Cheers,
    P.

    1st May 2012 at 12:19

  11. Lahse says:

    Hi All,

    I want to change the default View “Open Activity associated View” to “Open Activity”.
    Any Help please.

    Lahse

    20th June 2012 at 14:17

  12. Jukka Niiranen says:

    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?

    20th June 2012 at 20:25

  13. Lahse says:

    Hi Jukka,

    there is a possibility to change the default view Open Activity associated view in other view, when I click on activities?

    thanks,

    lahse

    21st June 2012 at 13:52

  14. Jukka Niiranen says:

    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.

    21st June 2012 at 19:33

  15. Lahse says:

    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?

    22nd June 2012 at 11:02

  16. Lahse says:

    I mean: can we per script, select open activity as default view?

    22nd June 2012 at 11:54

  17. Jukka Niiranen says:

    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.

    25th June 2012 at 11:52

  18. Manoj Mathew says:

    Hi Jukka,

    Is there a possible way in which one could Remove “Filter on” and “Include” options or make it hidden??

    Thanks,
    Manoj

    22nd September 2012 at 09:26

  19. Jukka Niiranen says:

    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.

    22nd September 2012 at 11:01

  20. Damian says:

    Hi Jukka,
    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.

    15th October 2012 at 23:56

  21. Jukka Niiranen says:

    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.

    18th October 2012 at 21:49

  22. Javier says:

    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

    19th October 2012 at 10:31

  23. Jon Valera says:

    Jukka,

    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?

    23rd January 2013 at 15:33

  24. Jukka Niiranen says:

    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.

    23rd January 2013 at 21:32

  25. SL says:

    Hi Jukka,

    Great post.
    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?

    Regards,
    SL

    3rd April 2014 at 18:03

  26. Jukka Niiranen says:

    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.

    4th April 2014 at 23:03

Leave a comment