Static Fetch XML Filters

There are multiple widgets that uses Fetch XML and we can set static filters to this fetch XML to get our desired data. In this how-to, we are going to explore about how to add static fetch XML filters to the fetch XML. There are number of static filter we can use with Fetch XML filters and they are listed below.

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


Here is example of how we can use this static filters on the Grid widget to show all the data related to current year.

  1. Drag and drop a Grid widget and click on the edit button to display the widget designer.
  2. Click on the Data tab > select contact Entity >Load Default Fetch > Build.
  3. From the build window add attribute to your fetch XML > select “CreatedOn”
  4. Add filter > select “CreatedOn” as the attribute > select “Equals” 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 save your designer changes. and your results will look this.

    How-to-fetchXML strings-1