web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Dynamically Change FetchXML Filters in Dynamics Portal using Liquid

(0) ShareShare
ReportReport
Posted on by 3,634

I am wondering if it is possible to dynamically change filters of a FetchXML in dynamics portal using Liquid, for example.

{% fetchxml fetchActivities %}
        
            
              
              
              
              
                {{% if {{ RecordId }} %}}
                
                {% else %}
                
                {% endif %}
              
            
          
        {% endfetchxml %}

Above code throw an exception, Unknown tag 'endif'

Please let me know if there is any idea to achieve above.

I have the same question (0)
  • Suggested answer
    - Matt Bayes - Profile Picture
    890 on at
    RE: Dynamically Change FetchXML Filters in Dynamics Portal using Liquid

    Hi Mohsin,

    It is definitely possible to dynamically change the filters.

    I think the issue is coming from your IF statement as you have the incorrect syntax for the filter.

    Instead of {{% if {{ RecordId }} %}} you need to have it as {% if RecordId %} as this will check to see if the RecordId variable/parameter is set.

    Try changing that up and see if it fixes the issue. I do have this in my own code for some clients so I know it's possible.

    If you can mark this as Answered assuming it solves your problems that would be appreciated!

    Also, if you're bored, checkout my blog here!

    Thanks!

    Matt Bayes

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 179

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 129 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans