web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

addCustomFilter to Owner field in Dynamics 365 Online

(0) ShareShare
ReportReport
Posted on by 2

Hi all,

I have had success using the addCustomFilter functionality on a lookup field with one table type (e.g. filtering an account lookup field) but I am unsure of how to make it work for the owner field which refers to both systemusers and teams.  Is this possible?

addCustomFilter (Client API reference) in model-driven apps - Power Apps | Microsoft Learn

Thank you!

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    If you want to add the filter to the user only table you can do the following:

    formContext.getControl("ownerid").addCustomFilter(filter, "systemuser");

  • Verified answer
    Steve Zhao2 Profile Picture
    on at

    Hi cjanow3,

    Yes, this is possible. Owner is a special lookup field, and it is associated with these two tables: user and team.

    So, if you want to filter both of these two tables. you need add two custom filter like this:

    function addCustomerFilter(executionContext){
    	var formContext = executionContext.getFormContext();
    	var owner = formContext.getControl("ownerid");
    	owner.addPreSearch(applyFilter);
    }
    
    function applyFilter(executionContext){
    	var formContext = executionContext.getFormContext();
    	var owner = formContext.getControl("ownerid");
    	var customerUserFilter = "";
        owner.addCustomFilter(customerUserFilter, "systemuser");
    	var customerTeamFilter = "";
    	owner.addCustomFilter(customerTeamFilter, "team");
    }
    

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 76

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans