web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Create custom search criteria for filter on view

(0) ShareShare
ReportReport
Posted on by

I'm trying to determine the best method of filtering a system view based on a current rolling date. So, in this case, I want to be able to show the view based on a filter containing "estimated close date" "on or before" "current day" or "4/29/2015" - which would then change to "4/30/2015" tomorrow... 

Any suggestions?

Thanks!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mamatha Swamy Profile Picture
    5,426 on at

    When you choose "On or Before" condition, you need to specify (select) a date.

    Instead, you can use something like Last week, Last Month. Last X days etc., This will give you records considering today's date.

    Hope this helps!

  • Community Member Profile Picture
    on at

    Sorry...should clarify - I'm looking to do this so it's a rolling date for the view. When you select on or before condition, it gives you the calendar grid, so I would have to change the system view each day to update the filter.

  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at

    Hi..

    Basically you need your view with dynamic filter.

    like

    for today -

    estimated close date - on or before  - 04/29/2015

    -- for tomorrow

    estimated close date - on or before  - 04/30/2015

    day after tomorrow

    estimated close date - on or before  - 05/01/2015

    and so on..

    To do this you need to write some custom code.

    CRM provided functionality to update view using code. So you can create some small console application.. and in this console application you need to update your view filter condition.

    you will find code here how to modify your view

    msdn.microsoft.com/.../gg328457.aspx

    once all is working fine then schedule your console application to run every day using windows scheduler..

    another option is create custom entity, and create recurring workflow on that entity and in workflow use custom workflow activity to update view filter condition.

    Here are some examples of creating recurring workflow

    blogs.msdn.com/.../scheduling-recurring-workflows-in-microsoft-dynamics-crm-2011-online-and-on-premise.aspx

    code.msdn.microsoft.com/.../Executing-Dynamics-CRM-93f3b52a

    gonzaloruizcrm.blogspot.com/.../quite-often-we-have-business-process.html

    Hope this will help..

  • Suggested answer
    Mamatha Swamy Profile Picture
    5,426 on at

    If you want to select the date each time you run/check the view then it cannot be done using the standard filters in views.

    I would suggest using a report that takes date as a parameter. Building such a report is fairly simple than going for extensive customization.

    technet.microsoft.com/.../dn531165.aspx

    blogs.msdn.com/.../parameterizing-fetch-based-reports.aspx

  • Community Member Profile Picture
    on at

    I think you are misreading the reply above. What Mamatha is saying is *don't* use the "on or before" operator.

    Instead use something like Last X years, and set X to 99. Now you have a condition that means "any time in the past".

    If you want to include today as well, then add an operator for "Today", then select both conditions and group them as an OR

  • mscrmba Profile Picture
    on at

    Hi Adam/sdseel - Last X years includes today by default  (for some business situations it would be ideal if it wouldn't but it is literally is any time in the past, even 5 minutes ago).  I understand 2015 Update 1 has some additional options in these criteria with 'Older Than' which will solve the problem I outline above (when you currently want to exclude today from your query).

    http://www.powerobjects.com/2015/03/31/top-10-new-features-in-microsoft-dynamics-crm-2015-update-1/

  • Community Member Profile Picture
    on at

    @mscrmba - you are absolutely right, all the "Last X ..." options are based on exact time, so these options will include anything that is overdue, but not those that are due later today. I often find that clients really want "anything that is overdue already, or should be dealt with today", hence my suggestion to group these with an OR.

    The new "older than X..." options unfortunately have the same approach as far as I understand it, so if you tried to exclude things on the basis of being "older than X days" with X set to 1, this would exclude some records from yesterday. So using:

    Last X Years,  X=99

    [implicit AND] Older than X days, X=1

    would result in things that are overdue by more than a day.

    Now, in the example here of Estimated Close Date, this is usually treated as a date only field, so the time portion is set to midnight (00:00) and "Older than X years" works when viewed any time today, since all of "today's" records are expected to close before we even get to work in the morning! This only become an issue if you have people using the same records in widely different time zones. So for the example at hand, no additional condition is probably needed, but it is useful for people to have a better understanding of the general principles here.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans