Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Only display users where phone # != null in corp directory

I'm trying to figure out how to only display users that have a phone number when anyone searches the corporate directory on a phone. I'm pretty sure it's the xmldirectorylist.asp that needs to be changed. I know my way around asp pretty well but I'm having a difficult time wrapping my head around this. Any help would be greatly appreciated.

5 REPLIES
Silver

Re: Only display users where phone # != null in corp directory

Line 128 of xmldirectorylist.asp looks like the place to tackle this. This line is where the user is added to the users array. Line 128 just adds the user's information to the user array; instead, you could check the value of userInfo.getTelephoneNumber() and only add the user to the users array if userInfo.getTelephoneNumber() returns a non-empty string (or feel free to parse it for specific patterns).

So perhaps something like:

...

userInfo = userInfoList.get(i);

if (userInfo.getTelephoneNumber() != "" ) {

users[i] = new user(... <-- same line as in the code on line 128

}

...

You shouldn't have to modify the similar code found on line 145 since that is already filtered by telephoneNumber (ie the user entered a telephone number to search on), but depending on your needs you could do something similar there but I don't think you'll need it).

It may be possible to modify the filters definitions on line 121 and 122 and add a filter for telephoneNumber, though I'm not sure offhand how to define a filter for "not null". You could look into that if you'd like.

Anonymous
N/A

Re: Only display users where phone # != null in corp directory

I'm on a different version of CM - 4.1(3)sr2 - but I found the same code you're referring to.

Putting in

if (userInfo.getTelephoneNumber() != "" )

gives me an error (undefined) when I make a search. I've been playing with it for awhile but for some reason it either doesn't like to skip an entry, or the if statement syntax is wrong somehow. Thanks for the help up to this point, any other ideas?

Anonymous
N/A

Re: Only display users where phone # != null in corp directory

I figured this out. If anyone needs any help on this let me know.

New Member

Re: Only display users where phone # != null in corp directory

Can you please let me know what you did to hide the null directory listings?

Thanks

Anonymous
N/A

Re: Only display users where phone # != null in corp directory

Sorry I did not get back here sooner. Hopefully you found your answer if not here it is.

Look for the following comments in xmldirectorylist.asp:

// Only add the last and first name search criteria if the value is non-null,

// otherwise UMX will match the field as any non-null value and records

// with empty values will not be returned

Just above this add the following lines:

var telephoneNumberVals = new ActiveXObject("UMX.UMStringListX");

var tnString = new String("*");

telephoneNumberVals.insert(tnString);

userSearchTable.put(keyTelephoneNumber, telephoneNumberVals);

What this is doing basically is adding a telelephone search criteria of "*" if nothing is entered into the "Number" search field. This will eliminate any users from being returned with no number.

125
Views
0
Helpful
5
Replies
CreatePlease to create content