cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JeffMP
New Member

Related records filter in portal

We have a portal that allows users to enter some basic information in tables. We want to create a form for another table that allows them to choose from the inputs they made earlier.  I know that lists can present data filtered by account and user. 

 

Is there a way to do this with look-up fields for input forms?  (Hopefully without writing code)

 

Would appreciate any help I can get!

7 REPLIES 7
OliverRodrigues
Super User II
Super User II

Can you explain a bit more the filter you are looking for?

If you need to filter the data that is presented in the lookup, you will need to write some code, please take a look at the following articles:

https://www.dancingwithcrm.com/custom-lookup-filtering-powerapps-portal/

http://oliverrodrigues365.com/2021/01/24/power-apps-portals-custom-lookup-filter/

 




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


 

Hi Oliver,

 

Thanks for responding. I've read your posts see that you are quite knowledgeable.

 

The tables that we want to use for source data are very simple, basically asking for lists of items pertinent to their operations. All we want to do is have the look-up field sort through the other tables to find data that relates to their account.  As an example, a user inputs a list of his company's products in a Product Table. We want to be able to have a look-up that goes back to the Product Table and finds products that relate only to that company.

 

I tried using the code presented in the dancingwithcrm blog but it didn't work. (Most likely I did something wrong.) Do you know of any resources who might be able to assist? Thanks.

OliverRodrigues
Super User II
Super User II

Hi, just going back a bit to a data-model design

Your Product Table should have a relationship (lookup) to the Account Table - do you mean Account or Contact in your scenario? Did you create this relationship?

Finally I think you can follow the steps provided in dancingwithcrm and that should work just fine

can you share a few snapshots so we see where the issue might be?




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


 

Oliver,

 

Thanks for the continued help.  I have created a lookup relationship for all of the tables. Account and Contact tables are set. 

 

In my portal, I've created other tables that relate to each other and this is where the related record filtering fails.  As an example, I have a table called Products, into which the user inputs product names. In other tables, I want to include the Product field as a Lookup that draws on the Product table and, hopefully, allows the user to choose the products that he/she previously input to the Product table. As it stands, the look up allows the user to choose from ALL products input to the Product table.

I've attached screenshots.  Tried to implement the dancingwithcrm code but I think I did something wrong. 

 

Thanks!

 

Jeff

OliverRodrigues
Super User II
Super User II

if you want to keep the lookup look & feel you will probably need to merge both articles I shared earlier.

did you create the Web Template with the Fetch? your fetch should be looking at the Product table and filtering by the contact/account

you should be able to unit test this by using navigating to the Web Page directly, i.e.: <portals>/product-json?contactid=XXXXXX

once you get this part working is time to work on the JS to replace the values from the lookup model, and that's where my article comes in place, to inject the JS into the modal and change the data

 

did you get the first part done? 




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


 

Thanks very much, Oliver. I did create a web template with Fetch. However, I don't recall whether I constructed it the way you suggest. Will go back and do that and try the unit test you suggest. If successful, I'll dig into your article and follow your suggestions there.

 

Really appreciate your continued help!

OliverRodrigues
Super User II
Super User II

no problem Jeff

a few things to follow:

  • create web template with fetch to products table
    • this web template must receive an input parameter (contactid or accountid)
    • the fetch needs to filter by the contact/account
    • render the results in a json format (like the dancingwithcrm article)
    • the web template must have the MIME Type as application/json
  • create the Page Template referencing the Web Template (untick the header/footer option)
  • finally create a Web Page pointing to the Page Template
  • test via browser passing the parameter.. you should see the json data
  • also don't forget you need to add table permissions when running fetch against a table
  • before I forget.. clear the cache



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

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Users online (34,612)