Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

How to filter lookup field in MSD 365 Web Portal ( ESS / Partner Portal )

Posted on by 437

Hi All,

We have lookup field called as "CBU" on Account form which contains all CBU records ( CBU is a custom entity )

We also have "Type " as optionset on Account form. 

We have "CBU automation" entity which holds relationship between Type ( optionset ) and CBU (lookup) records.

Once Type can have multiple CBU records and vice-a-versa. 

For ex : If Type "customer" has two CBU , we create two records in "CBU Automation" entity 

1.Type=Customer and CBU="XYZ"

2.Type=Customer and CBU="ABC"

On Account entity , If user selects Type field ,  all the related CBU should be filtered in CBU field on account entity. It will fetch data from third entity called as "CBU automation" in our case and apply custom filter on CBU field ( relationship mentioned in above example ).

I've completed this requirement in CRM using javascript code by applying dynamic custom filters to it. Can we do the same thing in MSD 365 Web Portals ? Can we customize lookup field in portals to bind custom filters like we do in CRM ? Or is there any other work-around for the same?

Your suggestion/solution would really be helpful.

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: How to filter lookup field in MSD 365 Web Portal ( ESS / Partner Portal )

    Hi Prashant,

    I don't think any direct way to do it, you will have to think some alternative. What I can suggest  is:

    1. Create a option set (Let say: OS1) field on form (only visible on Portal).

    2. Onchange of your Type option set field, write OData in order to fetch all the records associated to that Type from CBU Automation entity and bind the values in OS1 option set dynamically.

    Also set the value in your actual lookup field as well in order to save the right value in CRM.

    (using JavaScript)

    4.  Might need to run the same script on load of the form as well. if you are showing the Edit form of same record.

    Limitation: I would like you to go with this approach only if the data associated with Type is less. otherwise drop-down performance issue may occur.

    Option 2:

    Create multiple lookups of CBU Automation entity for each Type and set view in each lookup to show only specific Type records.

    For Example: if you have two types (type 1 and type2), so create two lookups(lookup1 and lookup2) and show view in each lookup to show only one specific type records.

    Let say: lookup1 will show only type1 records and lookup 2 will show only type 2 records.

    Now on portal. Hide and Show lookups based on your type value.

    Limitations: Not a good solution, if your Type is going to change frequently. Because, you'll have to add new lookup field, filter view and code change required at portal side.

    Cheers.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans