SMS Number From Roster Key Value Pair

In 7.9 is there a way to get a user’s SMS number from just having the username from the roster and not the user source?

I have to loop through every roster until I find the one I need.
Once the match is found, the value from the key:value pair is a list of usernames on that roster.
But they can be from different user sources, it doesn’t specify the user source.

Now I can loop through every user source (50+ user sources) and once there is a match, then I can extract the SMS number.
That is ALOT of looping because some user sources have 100+ users in it.

So one loop to loop through all the rosters then another loop to loop through all users in every user source, there has to be a better way.

Anyone have any ideas?

first thought, why do you have so many user sources? 2nd thought, maybe save the username in another table when the user is created and save the user source. then you can know directly where to look.

Expanding on @diat150’s post, I’d loop through the rosters on a periodic basis, and put the users / SMS info in a separate table for easy lookups.

I like that idea, that may be the best option.

@diat150 in regards to why we have so many user sources is we group them by customers and internal business units. When there is 1000+ users created its the best way to group them (and by no means all 1000+ users ever login, most of them just get alarms, reports, etc.).

Good news: we do have a feature ticket to make it so the user source for each username in a roster can be obtained.

Bad news: whenever it happens, it’s almost certainly not coming to 7.9.

I have a similar situation but only use 1 user source. when I create a new user they get assigned to a client ID and I use that to filter out other users that dont belong in their group.