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:
- @now@ - injects the current date and time into the FetchXML.
- @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.
Example
In this example, we will use static filters on the Grid widget to display all of the data related to the current year.
- Drag and drop a Grid widget onto the page, then click on the Edit button to display the widget designer.
- Click on the Data tab, then select contact Entity > Load Default Fetch > Build.
- From the build window, add an attribute to your FetchXML and then select CreatedOn.
- To add the filter, select CreatedOn as the attribute, then the On 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 and save your designer changes, your results will look like this: