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 Apps / Filter salesrep based ...
Power Apps
Answered

Filter salesrep based on office365users to match our own userid

(0) ShareShare
ReportReport
Posted on by 40

Thanks in advance for any help.

 

I am trying to filter based on office365user (currently logged in) using Office365Users.MyProfile().MailNickname which is for example "rjohnson". I'd like Office365Users.MyProfile().MailNickname to match our own company UserID. Upon matching I want ComboBox.Salesrep to return Salesrep field equals to only Robert Johnson.

 

Datasource 1: Office365Users 

Field: MailNickname

 

Datasource 2: Salesrep_tbl (Sharepoint list)

Field: UserID & Salesrep

 

Again, appreciate the help.

 

 

 

 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at
    @baller72
    Do you want the SalesRep to show in the Combobox? Try putting this code in the DefaultSelectedItems or (Default) property of the SalesRep Combobox. It will retrieve the record.

    Lookup(Salesrep_tbl,UserID= Office365Users.MyProfile().MailNickname)

    If you just want to get the sales rep name as a text string so this instead

    Lookup(Salesrep_tbl,UserID= Office365Users.MyProfile().MailNickname.SalesRep)

    —-
    Please Accept as Solution if this post answered your question so others can find it more quickly. If you found this post helpful consider giving it a Thumbs Up!
  • baller72 Profile Picture
    40 on at

    @mdevaney 

     

    Hey there. Thanks!

     

    Here's what I see.

     

    image14.png

  • v-xida-msft Profile Picture
    on at

    Hi @baller72 ,

    Could you please share a bit more about the UserID column in your Salesrep_tbl SP List? Is it a Single text type column?

    Could you please share a bit more about the Salesrep column? Is it a Choice type column?

    Further, do you add a ComboBox to connect to the Salesrep column in your SP List?

     

    I have made a test on my side, please take a try with the following formula:

    LookUp(Salesrep_tbl, UserID = Office365Users.MyProfile().MailNickname, Salesrep)

    or

    LookUp(Salesrep_tbl, UserID = Office365Users.MyProfile().MailNickname).Salesrep

    Note: I assume that the User ID column is a Single text type column.

     

    If the Salesrep column is a Choice type column, and you want the ComboBox to connect to this column where current login user MailNickName matches the User ID column, please take a try with the following workaround:

    Set the Items property of the ComboBox to following:

    Filter(
    Choices(Salesrep_tbl.Salesrep),
    Value in Filter(Salesrep_tbl, UserID = Office365Users.MyProfile().MailNickname).Salesrep.Value
    )

    If the  Salesrep column is a Single text column, please set the Default property of a Text Input box to following:

    LookUp(Salesrep_tbl, UserID = Office365Users.MyProfile().MailNickname, Salesrep)

    or

    LookUp(Salesrep_tbl, UserID = Office365Users.MyProfile().MailNickname).Salesrep

     

    Please consider take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • baller72 Profile Picture
    40 on at

    Hey @v-xida-msft .

     

    Thanks for helping out. I will give this a go then let you guys know.

     

    Salesrep - Single line of text ( I added a combobox)
    UserID - Single line of text

     

    Appreciate your time.

     

  • baller72 Profile Picture
    40 on at

    Hi @v-xida-msft ,

     

    Please see error messages. Placed this in Default property.

     

    image15.png

     

    image16.png

  • baller72 Profile Picture
    40 on at

    @v-xida-msft 

     

    I was able to filter the salesrep, but have this warning. Any work around?

     

     

    Items property (warning)

    image17.png

     

     

    Default property (error)

    image18.png

     

     

    DefaultSelectedItems property (warning)image19.png

  • Verified answer
    v-xida-msft Profile Picture
    on at

    Hi @baller72 ,

    Based on the screenshot that you mentioned, I think you have faced a Delegation warning issue with your formula.

     

    If you have faced a Delegation warning issue with your formula, it means that you could not delegate the data process to your data source itself (on your side, it is Salesrep_Distinct_UserID), instead, you could only process your data locally.

    If the amount of your Salesrep_Distinct_UserID data source records is not more than 2000, you could ignore this warning issue. More details about the Delegation warning issue, please check the following article:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview

     

    In order to get rid of this Delegation warning issue, please consider take a try with the following workaround:

    Set the OnStart property of the App to following:

    Set(CurrentUserNickName, Office365Users.MyProfile().MailNickname)

    Then modify your Filter formula as below:

    Filter(Salesrep_Distinct_UserID, UserID = CurrentUserNickName).Salesrep

    then re-load your app (fire the OnStart proeprty of App), check if the issue is solved.

     

    Best regards,

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard