cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerPedro
Regular Visitor

How do I fecht URL query params in liquid in order to index a data entity?

Hi,

 

I am just starting with Power Portals and I have this question. In one page I have a list component where I display an entity, when I click in one record I want to show the details in another page. 

 

With this code I can access the entity:

 

{% assign object = entities.cr21d_object['90153843-bb6c-eb11-8fed-0003ff1d219a'] %}
{% if object %}
Object found
{{ object.cr21d_name }}
{% endif %}
 
but I am missing the point who I get the ID that I see in the URL query in order to pass through the appropiate id.
 
The query looks like this:
 
xxxx.powerappsportals.com/objects-1/view-objects-1/?id=90153843-bb6c-eb11-8fed-0003ff1d219a
1 ACCEPTED SOLUTION

Accepted Solutions
mbayes
Resolver I
Resolver I

Hi Pedro,

 

There is an object in liquid called "request". The "request" object contains all information about the URL, parameters, etc. that you will need.

In order to retrieve the parameter, all you need is the following line:

{% assign requestId = request.params.id %}


If your parameter was called "recordid", for example, the code would look like:

{% assign requestId = request.params.recordid %}

 

I hope this helps, and feel free to ask me any questions you might have!

Thanks!

 

Matt Bayes

View solution in original post

2 REPLIES 2
mbayes
Resolver I
Resolver I

Hi Pedro,

 

There is an object in liquid called "request". The "request" object contains all information about the URL, parameters, etc. that you will need.

In order to retrieve the parameter, all you need is the following line:

{% assign requestId = request.params.id %}


If your parameter was called "recordid", for example, the code would look like:

{% assign requestId = request.params.recordid %}

 

I hope this helps, and feel free to ask me any questions you might have!

Thanks!

 

Matt Bayes

PowerPedro
Regular Visitor

Hi Matt,

 

Thanks. I already solved it in a similar way:

 

<div class="col-md-4 columnBlockLayout" style="display: flex; flex-direction: column;">
      {% assign objectId = request.params['id'] %}
      {% assign object = entities.cr21d_object[objectId] %}
      {% if object %}
      <b>Store</b>
      {{ object.cr21d_name }}</p>
      <b>Country</b>
      {{ object.cr21d_country }}</p>

Apart from that I had to assing Entity Permissons in the Portal Management or I would get empty results.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

Users online (3,118)