
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) 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