Static FetchXML Filters

There are multiple widgets that use FetchXML to query data. We can apply additional static filters to this FetchXML to return the desired results. Listed below are the available static filters:

  1. @now@ - injects the current date and time into the FetchXML.
  2. @today@ - injects the current date.
  3. @today.year@ - injects the current year.
  4. @today.month@ - injects the current month number.
  5. @today.day@ - injects the current day number.

Example 

In this example, we will use static filters on the Grid widget to display all of the data related to the current year.

  1. Drag and drop a Grid widget onto the page, then click on the Edit button to display the widget designer.
  2. Click on the Data tab, then select contact Entity > Load Default Fetch  > Build.
  3. From the build window, add an attribute to your FetchXML and then select CreatedOn.
  4. To add the filter, select CreatedOn as the attribute, then the On operator. To filter by the year, add @today.year@ as the value. 

    How-to-fetchXML strings
  5. Once you finish configuring your fetch click Save & Close.
  6. Once you finish configuring the widget and save your designer changes, your results will look like this:

    How-to-fetchXML strings-1