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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

how to pass javascript variable into liquid fetch in portal ?

(0) ShareShare
ReportReport
Posted on by 150

I need to get HTML text box value and pass it into fetch which is inside the liquid tag. 

var str = $("#field).val();
{% fetchxml _query %}
      <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
           <entity name='xxx'>                                                     
                 <attribute name='name' />                                                     
                         <filter type='and'>
                             <condition attribute='name' operator='like' value='str' />
                          </filter>
               </entity>
        </fetch>
{% endfetchxml %}
I have the same question (0)
  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at

    Liquid is rendered at server side, so you can't get values from elements that are still to be rendered on the client-side

    can you tell a bit more of your requirement? there might be other ways to achieve that

  • cloflyMao Profile Picture
    25,210 on at

    Hi Soundar,

    As Oliver suggested, you can't pass javascript variable to liquid snippet.

    It could be said that liquid will always excute before javascript, which means we can pass liquid variable to javascript side;

    On the contrary, we couldn't do it. 

    If you would like to add custom filters for your retrieving result, 

    it's highly recommended to render an entity list and enable its build-in filters directly.

    {% include 'entity_list' key: page.adx_entitylist.id %}

    Web template:

    pastedimage1585543484160v1.png

    Entity list with its "Metadata Filter" option has been enabled.

    pastedimage1585542784703v1.png

    Rendered entity list:

    pastedimage1585542814574v2.png

    If you would still like to use custom input control/element, then you could create an odata set from entity list and send value from custom input field as filter to endpoint of the set.

    https://www.cloudfronts.com/creating-entity-lists-odata-feed-using-custom-javascript-crm-portals/

    Regards,

    Clofly

  • AkshayShah Profile Picture
    70 on at

    Hello Oliver,

    i have same requirement that i have one datepicker of textbox. i have get date date from date picker and assign selected date in liquid variable.

    i have assign this date to liquid variable but i can't assign this date in liquid variable.

    Thanks in Advance,

    Akshay Shah

  • oliver.rodrigues Profile Picture
    4,052 on at

    Hi Akshay, this is a very old thread, I would recommend creating a new post on the power apps portals forum: powerusers.microsoft.com/.../PowerAppsPortals

    Also not sure I understand what you need.. do you have a datepicker, or a textbox?

    when/how are you rendering your form? can you share code/snapshots?

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans