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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Fetchxml with dynamic ...
Power Pages
Unanswered

Fetchxml with dynamic value without json

(0) ShareShare
ReportReport
Posted on by 6

My requirement is to get all the details of an entity on the second page when I click on the email button on first page. I have tried -

1. if else condition in liquid code but was not able to fetch user input in liquid

2. in the for loop I was getting all the email ids to compare with the user input email id.

I have used fetchxml to only get the data

{% fetchxml inprogress_query %}
    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="cr2d2_edueventattendee">
        <attribute name="cr2d2_edueventattendeeid" />
        <attribute name="cr2d2_firstname" />
   <attribute name="cr2d2_lastname" />
<order attribute="cr2d2_firstname" descending="false" />
        <filter type="and">
          <condition attribute="cr2d2_email" operator="eq" value="{{}}" />
        </filter>
      </entity>
    </fetch>
 What should i pass inside value to get the single email record that user has entered and match it with data verse to display details on second page?
Categories:
I have the same question (0)
  • Lucas001 Profile Picture
    2,429 Super User 2025 Season 2 on at

    Hi @CoSonate1,

     

    liquid is execute on the server side so you won't be able to run it properly when somebody chooses or enters something in  textfield etc.

    The approach usually is to create a blank page, use the liquid to fetch all inside a JSON and than use a fetch JSON function to get all needed info.



    --------------------------------------------------------------------------------------

    Hope that helps.

    If the post solves your problem, please mark it as solution. If it helps, consider a thumbs up.

  • CoSonate1 Profile Picture
    6 on at

     I have changed my code to this and it is still not working. I have added the site settings and even enabled the table and column permissions but I am getting results as blank, I have added this code in a web template

     

      {% assign email = request.params['email'] %}

       {% fetchxml inprogress_query%}

        <fetchversion="1.0"output-format="xml-platform"mapping="logical"distinct="false"count="1">

          <entityname="cr2d2_edueventattendee">

             <attributename="email"/>

            <orderattribute="name"descending="false"/>

            <filtertype="and">

             <conditionattribute="email"operator="eq"value="{{email | xml_escape}}"/>  

            </filter>

          </entity>

        </fetch>

        {% endfetchxml %}

        {

    "results": [

    {% for result in inprogress_query.results.entities %}

    "{{ result.edueventattendeeid | escape }}

    {{ result.email }}

    "{% unless forloop.last %},{% endunless %}

    {% endfor %}

    ]}

     

          <script>

              $("#searchtbutton").click(function () {

               

    $.ajax(

      method: 'GET',

      dataType: 'json',

      url: "/details?Email=" + encodeURIComponent(myEmailVariableHere)

    }).done(function(data) {

      console.log("I found " + data.results.length + " result(s)");

    });

    }); 

          </script>

    With reference to -https://powerusers.microsoft.com/t5/Power-Apps-Portals/How-to-execute-FetchXML-query-on-button-click/td-p/685159

  • Fubar Profile Picture
    8,350 Super User 2025 Season 2 on at
    what happens if you hardcode the email address in the query? (if still no results, run the query from XrmToolBox to see if you get any results there)
  • CoSonate1 Profile Picture
    6 on at

    I can now fetch values from power portal webapi ,but one of my code is not working with webapi

    success: function (res) {
            console.log(res);
                    window.location = "https:/contoso.powerappsportals.com/details/?id="+res.value[0]. crd2_id;
            },
            fail: function () {
              console.log();
              alert("Doesnt work");
              }
    I dont get the alert message. Can anyone help me with it.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 74 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 55

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard