Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

Portal - Child Lookup filter



In my web form I have 2 lookup fields. First lookup looks to a parent entity say Account. Second lookup looks to a child entity say Contacts.


When I select 1st lookup (account) record, 2nd lookup (contact) should filter accordingly to show only the contact records where parent = 1st lookup. 


I have checked this blog where dependant functionality is possible using "rendering as dropdown" however I would like to maintain the lookups and do the same.


I have also checked this blog where lookups can be restricted to show only certain records which is similar to what I am looking for.


I am seeking help to find the exact JS that I am looking for in my scenario.


Can anyone advise me please?


@OOlashyn @OliverRodrigues 




Solution Sage
Solution Sage

Not sure exactly what your overall data structure is, but standard related record lookups work in the Portal (when you don't set the render as dropdown option) - so does your child record contain a lookup to the Account?.

Super User II
Super User II

Hi @arjunmusuvathy how far have you got at this stage?

I think by merging the two articles you should probably get the final code you need.

Have you created your Web Template to return the list of records you need? Once you have that, you can read it via JS, and then loop/remove the unwanted records from the lookup grid.

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User

Oliver Rodrigues


Helper III
Helper III



Thanks for your reply. 


Below is my web template:


{% fetchxml feed %}
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
- <entity name="contact">
<attribute name="contactid" />
- <filter type="and">
<condition attribute="test_intaccountid" operator="eq" value="{{ request.params['id'] }}" />
{% endfetchxml %}{
"results": [
{% for item in feed.results.entities %}
"Id": "{{ item.}}",
"Name": "{{ item.}}",
}{% unless forloop.last %},{% endunless %}
{% endfor %}

Below is my JS:
I have added a comment in the JS below where I am not sure how to add the fetch results in the lookup.

$(document).ready(function () {
// register on change of Account lookup


function onAccountChange(){
// get id of selected account field
var accountID = $("#test_intaccountid").val();

if(accountID != null && accountID !=""){
// request to our custom page with id as parameter
$.getJSON( "/categorization-json?id="+accountID, function( data ) {

data.results.forEach(element => {


Helper III
Helper III

@OliverRodrigues @Fubar  I am closing this ticket down as the OOB dynamics form lookup filtering works in portal. I have a filtering issue in Account lookup but I will comment in my another forum question. Thanks for your time guys.

sorry @arjunmusuvathy .. just seeing this one now

in your fetch, it seems that you are missing the attributes you want to retrieve from the contact entity, please consider adding the attribute tags:

<attribute name="name" />

 still in your Liquid, the below seems to be missing the attributes you need to add the attributes there:

"Id": "{{ item.}}",
"Name": "{{ item.}}",

to fetch your data, have you tried the following (once the two things mentioned above are fixed)?:

var contactId =;
var contactName =;



If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User

Oliver Rodrigues


Helpful resources

PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,363)