cancel
Showing results for 
Search instead for 
Did you mean: 

Search Users

srinivas_sistu
Active Contributor
0 Kudos

Dear All,

I am trying to search users available in EP through WDJava. Search Parametres will be

first name, last name and userID.

Now, to search users by name, i am using the below code...

if(wdContext.currentVn_SearchEmpElement().getVa_EmpFName()!=null || wdContext.currentVn_SearchEmpElement().getVa_EmpLName()!=null)

{

if(wdContext.currentVn_SearchEmpElement().getVa_EmpFName()!=null && wdContext.currentVn_SearchEmpElement().getVa_EmpLName()!=null)

{

strSearchName=wdContext.currentVn_SearchEmpElement().getVa_EmpLName()"*"wdContext.currentVn_SearchEmpElement().getVa_EmpFName();

}

else

{

if(wdContext.currentVn_SearchEmpElement().getVa_EmpFName()!=null)

strSearchName=wdContext.currentVn_SearchEmpElement().getVa_EmpFName();

else if(wdContext.currentVn_SearchEmpElement().getVa_EmpLName()!=null)

strSearchName=wdContext.currentVn_SearchEmpElement().getVa_EmpLName();

}

uFilt.setDisplayName(""strSearchName"",

ISearchAttribute.LIKE_OPERATOR,false);

ISearchResult result = uFact.searchUsers(uFilt);

if (result.getState() == ISearchResult.SEARCH_RESULT_OK) {

while (result.hasNext()) {

String uniqId = (String) result.next();

IUser thisuser= uFact.getUser(uniqId);

cmb=new CallMemoBean();

cmb.setStrEmpFName(thisuser.getFirstName());

cmb.setStrEmpLName(thisuser.getLastName());

cmb.setStrEmpId(thisuser.getUniqueName());

serarchList.add(cmb);

}

Is there any better way to search users...

Regards,

SrinivaS

View Entire Topic
Former Member
0 Kudos

Hi Srinivas,

Check this document it will help you in some extent

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b09cc7ef-8185-2b10-4aaa-96ffc93d...

Thanks,

Tulasi Palnati

Edited by: Tulasi Palnati on Jun 3, 2009 2:27 PM

srinivas_sistu
Active Contributor
0 Kudos

Hi Tulasi,

Thank you very much for reply. But in that document he is searching users usind UniqueName(...), which will search users with given userID. I want to search them on the basis of

First Name (if not null),

Last Name (if not null) and First Name+Last Name (if both are not null)

I am able to achieve the first two, but for the last option as i am not able to set the filter twice, i am using setDisplayName.... Any help???

Regards,

SrinivaS

Former Member
0 Kudos

Hi Srinivas

Please delete the second link which was given by me above because it points to different solution.I am not able to delete it.

Based on firstname and lastname .

Thanks,

Tulasi Palnati

Edited by: Tulasi Palnati on Jun 3, 2009 2:43 PM

srinivas_sistu
Active Contributor
0 Kudos

Hi,

Tulasi,

uFilt.setFirstName(""wdContext.currentVn_SearchEmpElement().getVa_EmpFName()"",

ISearchAttribute.LIKE_OPERATOR,false);

uFilt.setLastName(""wdContext.currentVn_SearchEmpElement().getVa_EmpLName()"",

ISearchAttribute.LIKE_OPERATOR,false);

it worked...

Thanks alot....

Regards,

Srinivas