Question

CRM 2013-OnPremise

Hello,

I have written a basic View for projects with a start date in the next seven days that is defined by this fetchXML:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
  <entity name="xxxx_project" >
    <attribute name="xxxx_startdate" />
    <attribute name="xxxx_accountid" />
    <attribute name="xxxx_produom" />
    <order attribute="xxxx_name" descending="false" />
    <filter type="and" >
        <filter type="and" >
            <condition attribute="statecode" operator="eq" value="0" />
            <condition attribute="xxxx_projectstatus" operator="eq" value="331420009" />
            <condition attribute="xxxx_materialsshipdate" operator="null" />
            <condition attribute="xxxx_startdate" operator="next-x-days" value="7" />
        </filter>
    </filter>
    <attribute name="xxxx_projectid" />
  </entity>
</fetch>

Now I was expecting the fetchXML to have the system date injected into it or at least a place holder such as:

<condition value='2012-03-08T15:10:00Z' />

Perhaps this value is added at runtime and is not part of the fetchTemplate? So Msoft does some runtime changes to something like this?

<condition attribute="xxxx_startdate" operator="next-7-days" value="2014-04-23" />

This article says it is injected http://social.microsoft.com/Forums/en-US/c5083689-65fb-474f-a7bc-2eff393016fe/datetime-on-or-after-of-fetchxml-questions?forum=crmdevelopment

But does not give me any idea of what that should look like.

The reason I ask is that I want to use this basic fetchXML as a template but inject a date of my choosing.

Any idea?

Was it helpful?

Solution

If you want to build dynamically the fetchXML simulating a next 7 days condition based on your date, you can always rewrite it using On or Before and On or After conditions. For example

<condition attribute="xxxx_startdate" operator="on-or-after" value="2014-04-23" />
<condition attribute="xxxx_startdate" operator="on-or-before" value=2014-04-30" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top