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 / Content snippet to dis...
Power Pages
Unanswered

Content snippet to display entity content via liquid object

(0) ShareShare
ReportReport
Posted on by

I have created a custom web template that displays data (vacancies) from an entity list and this is working. What you'll see is that I have created a link/button for each record and I'm passing the item.id into the url to take the user through to a Job Spec page where they can see more about the vacancy and start the application process.

 

 

 {% entitylist key: page.adx_entitylist.id %}
 {% entityview logical_name: 'pfc_vacancy' name:'Active Vacancies Web View', page_size:20 %}
 {% for item in entityview.records %}
 <item>
 <div class="list-group stack"> 
 <h4 class="list-group-item-heading">{{ item.pfc_jobtitle }}</h4>
 <p class="list-group-item-text">{{ item.pfc_jobdescription }}</p>
 <p class="list-group-item-text">{{ item.pfc_location.label }}</p>
 <p class="list-group-item-text">{{ item.pfc_contracttype.label }}</p>
 <p class="list-group-item-text">{{ item.pfc_contractedhours.label }}</p>
 <a href="/job-specification/?id={{ item.id }}" class="details-link has-tooltip btn btn-primary" data-toggle="tooltip" title="Learn more">Learn More</a>
 </div>
 </item>
 {% endfor %}
 {% endentityview %}
 {% endentitylist %} 

 

 

What I want to do is populate the Job Description/Specification page with data from the Vacancy entity. II followed along with this article: https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/customize-content-snippets but in the example the GUID is hardcoded which seems very limited in terms of it's real-world application from where I am standing.

I tried this content snippet:

 

{% assign vacancy = entities[pfc_vacancy][request.params['id'] %} 
{% if vacancy %} 
<b>{{ vacancy.pfc_jobtitle }}</b> 
{% endif %}

 

This was a very speculative effort - I thought that this might give me the id that was passed into the url and that would 'unlock' the rest of the data for me but I got a Liquid error message (see screenshot):

liquid__error.png

 

I have to admit I'm a little bit stuck on this one and would really appreciate a gentle push in the right direction. Thanks in advance

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    I had my wires crossed - the hard-coded GUID was for the entity not a single record which actually makes a lot more sense 🤣. I changed my snippet:

     

    {% assign vacancy = entities.pfc_vacancy['04e63410-eed7-4f74-bccd-faf452bcd29b'] %}
    {% if vacancy %}
    {{ vacancy.pfc_jobtitle }}
    {% endif %}
    {% assign entity_logical_name = 'vacancy' %}
    {% assign vacancy = entities[entity_logical_name][request.params.vacancyid] %}
    {% if vacancy %}
    {{ vacancy.pfc_jobtitle }}
    {% endif %}

     

    But it's still not working

  • Verified answer
    OOlashyn Profile Picture
    3,496 Most Valuable Professional on at

    Hi @jimmiryquai ,

     

    I can see at least two issues in your code:

    1) 

    {% assign entity_logical_name = 'vacancy' %}

     you need to write a logical name for your entity with publisher prefix ie pfc_vacancy instead vacancy

    2) request.params is a special object - to obtain data from it you need to provide the name of the parameter like this request.params['vacancyid']. Make sure that you pass vacancyid as a URL parameter to be able to obtain it.

     

    Here you can find more info on how to work with liquid templates here and here you can find more about request object.

  • Community Power Platform Member Profile Picture
    on at

    Hey @OOlashyn  - thanks for your input and you were right... it was my execution that was the problem! However I was passing id as the parameter and not vacancyid (which I tried) so the following code resolved the issue:

     

    {% assign vacancy = entities.pfc_vacancy['04e63410-eed7-4f74-bccd-faf452bcd29b'] %}
    {% if vacancy %}
    {{ vacancy.pfc_jobtitle }}
    {% endif %}
    {% assign entity_logical_name = 'pfc_vacancy' %}
    {% assign vacancy = entities[entity_logical_name][request.params.id] %}
    {% if vacancy %}
    {{ vacancy.pfc_jobtitle }}
    {% endif %}

     

    Thanks again for your reply and it was close enough to being the solution so I'll mark it as such 👌👍🤝

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
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard