cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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
Highlighted
Community Support
Community Support

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
Highlighted
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!
Highlighted
Helper I
Helper I

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

@mdevaney 

 

Hey there. Thanks!

 

Here's what I see.

 

image14.png

Highlighted
Community Support
Community Support

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.
Highlighted
Helper I
Helper I

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.

 

Highlighted
Helper I
Helper I

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

Highlighted
Helper I
Helper I

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

Highlighted
Community Support
Community Support

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,554)