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

Combobox DefaultSelectedItems - Office365Users - Show Blank if SharePoint is Blank

We have a PowerApps-based ticketing system that's currently in use. We're constantly re-evaluating the code to make it faster, better, more efficient, etc.

 

Our PowerApps has 3 screens:

1. Intake screen

2. Edit screen

3. Tickets List

 

The Intake & Edit screens are essentially the same. The biggest difference - the Default property for the Edit screen points to SharePoint for the ticket selected from the Tickets List. One of the fields is Team Assignee. It's a Combobox in PowerApps and a User/Group field in SharePoint (in PowerApps, it's "TeamAssignee_Intake" and "TeamAssignee_Edit")

> The Items property for the fields on both screens is --> Office365Users.SearchUser({searchTerm: Self.SearchText, top: 5})

> The DefaultSelectedItems property on the Edit screen is: Office365Users.SearchUser({searchTerm:LookUp('SharePoint List',ID=VarThisRecord,'Team Assignee'.DisplayName)})

>>> Note - VarThisRecord --> is set to the ID of the ticket from the Tickets List.
 
Problem - on the Edit screen - if the Team Assignee on SharePoint is blank (as it should be for new tickets), the TeamAssignee_Edit field is showing the very first record in the Office365Users table instead of a blank. When the user clicks an "Update" button on the Edit screen, it's patching back that first record, which is the incorrect choice. I've tried every combination of "If(IsBlank(..." I can think of and can't get this to work. Any help is appreciated to get the DefaultSelectedItems to show blank!
1 ACCEPTED SOLUTION

Accepted Solutions
WillPage
Solution Sage
Solution Sage

I tried this and it worked OK:

 

If(IsBlank(Blank()),[],Office365Users.SearchUserV2({searchTerm:Blank()}).value)

 

Replace Blank() with your variable name and LookUp formula, and adjust the formula as you still seem to be using the old version of the SearchUser function.

View solution in original post

2 REPLIES 2
WillPage
Solution Sage
Solution Sage

I tried this and it worked OK:

 

If(IsBlank(Blank()),[],Office365Users.SearchUserV2({searchTerm:Blank()}).value)

 

Replace Blank() with your variable name and LookUp formula, and adjust the formula as you still seem to be using the old version of the SearchUser function.

BINGO! Thanks very much!!!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,322)