You need to sign in to do that
Don't have an account?

Apply search filter on VF Page
Hi All,
I am new to Salesforce and need some urgent help to write logic for search filter on VF Controller.
I have two filer field i.e. Name and Email id on lookup VF page which display the list of users and it is being controlled by a controller.
Request you please suggest me a logic in such a way like if a user tries to search with Name, Email id or both. Then the list should populate result accordingly.
I want to put this in the 'Where' condition to fetch the result using string Soql.
Select name,emailid from User where name like '%XYZ%' and EMaild like '%XYZ%';
Kindly suggest.

Regards,
Vinay
I am new to Salesforce and need some urgent help to write logic for search filter on VF Controller.
I have two filer field i.e. Name and Email id on lookup VF page which display the list of users and it is being controlled by a controller.
Request you please suggest me a logic in such a way like if a user tries to search with Name, Email id or both. Then the list should populate result accordingly.
I want to put this in the 'Where' condition to fetch the result using string Soql.
Select name,emailid from User where name like '%XYZ%' and EMaild like '%XYZ%';
Kindly suggest.
Regards,
Vinay
apex:
VF
Mark as best answer if it helps you.
Thanks,
Ghanshyam Choudhari
All Answers
apex:
VF
Mark as best answer if it helps you.
Thanks,
Ghanshyam Choudhari
Hi Ghanshyam,
Thanks for your Response.
I tried and it is not working as expected. Like if user enters only Firstname then it should filter with Firstname. Similarly, if a user enters only email id then it should search with email id.
And if a user enters both the information then it should filter by applying both the condition.
I hope you can help me on this as well.
-- Vinay
Thanks