cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
baller72
Level: Powered On

Filter salesrep based on office365users to match our own userid

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.

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Filter salesrep based on office365users to match our own userid

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Super User
Super User

Re: Filter salesrep based on office365users to match our own userid

@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
Level: Powered On

Re: Filter salesrep based on office365users to match our own userid

@mdevaney 

 

Hey there. Thanks!

 

Here's what I see.

 

image14.png

Community Support Team
Community Support Team

Re: Filter salesrep based on office365users to match our own userid

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
baller72
Level: Powered On

Re: Filter salesrep based on office365users to match our own userid

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
Level: Powered On

Re: Filter salesrep based on office365users to match our own userid

Hi @v-xida-msft ,

 

Please see error messages. Placed this in Default property.

 

image15.png

 

image16.png

baller72
Level: Powered On

Re: Filter salesrep based on office365users to match our own userid

@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

Community Support Team
Community Support Team

Re: Filter salesrep based on office365users to match our own userid

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (7,200)