cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jwheadrick
Frequent Visitor

O365 search - 0 or more than 1 result

I have an excel spreadsheet which has a 'User Name' column - this is a free text field.  I consume this field and do a 0365 search to pull back the users email address.  This all works wonderful, but with some conditions that we want to prevent from happening:

1.) User provided in the excel spreadsheet returns many hits in 0365.  Say for example they enter only Jason.  If there are 10 Jason's returned then i get all 10 email addresses returned.  If i restrict to top 1 then I could get an email address for the wrong Jason that is intended.  In this case, I want to email this record to a team member so that they know more than 1 result was returned and we aren't sure who the email should be sent to.  They can then update the spreadsheet for this to be sent later.

2.) Users provides a name that get zero matches.  I also want to send this record to a team member to review and fix.

3.) Blank records - I was able to get these filtered out.....however it would be nice to have all 3 scenarios grouped into one email to a team member to resolve while all other records with only one found email succeeds.

I hope that makes sense.  Let me know if anyone has a good idea.

1 REPLY 1
Gristy
Resident Rockstar
Resident Rockstar

1) do not do top 1, but instead use the resulting loop to increment a counter, if it ends up greater than 1, email them instead of doing whatever else you are doing

2) you can do the same as 1 i.e. counter = 0 or counter > 1

3) you can do a empty(your variable here) expression to check if its empty and increment your counter

 

Cheers

 

Chris

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,808)