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.
- @now@ - injects the current date and time into the fetch xml
- @today@ - injects the current date
- @today.year@ - injects the current year
- @today.month@ - injects the current month number
- @today.day@ - 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.
- Drag and drop a Grid widget and click on the edit button to display the widget designer.
- Click on the Data tab > select contact Entity >Load Default Fetch > Build.
- From the build window add attribute to your fetch XML > select “CreatedOn”
- Add filter > select “CreatedOn” as the attribute > select “Equals” operator. To filter by the year add @today.year@ as the value.
- Once you finish configuring your fetch click “save & close”
- Once you finish configuring the widget save your designer changes. and your results will look this.