Tip #444: When any time will do

Dynamics CRM TipperWhy sometimes it’s easy to write a mini truckstop tip? Because all you have to do is to stop and listen to a conversation between two people passionate about Dynamics CRM.

Jamie “Xerox” Miley challenged one of the CRM foundation stones, Advanced Find:

I am trying to understand the utility of writing this clause. I came across it earlier today and had a head-scratcher moment.

Question: What is the difference between filtering a datetime on “Any Time” and excluding the filter?

Any date will do

Feridun “Best Twitter Handle for CRM MVP” Kadir paused for a split second before nailing the answer:

Hmm, interesting question. I investigated this by looking at the FetchXML for Any Time which is

<fetch version="1.0" output-format="xml-platform" 
       mapping="logical" distinct="false">
  <entity name="opportunity">
    <attribute name="name" />
    <attribute name="customerid" />
    <attribute name="estimatedvalue" />
    <attribute name="statuscode" />
    <attribute name="opportunityid" />
    <order attribute="name" descending="false" />
    <filter type="and">
      <condition attribute="estimatedclosedate" 
                 operator="not-null" />
    </filter>
  </entity>
</fetch>

This is exactly the same as for the test “Contains Data”.

So Jamie, excluding the filter “Any Time” means that, as per your screenshot, all open records are returned. Adding the filter, means that only open records where Est. Close Date has a value are returned.

Perhaps there is some historical reason in earlier versions of CRM for Any Time.

Leave a Reply

Your email address will not be published. Required fields are marked *