Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am new to Salesforce

I created one vf page with input texts as following:

SearchApplicants  
skillset_______  
skeywords_______  
sexperience_________  
sexpected salary________
[ search] <-------  by clicking on search 

By entering values in the above fields and clicking on the search button I need to get the records (relating to that search criteria) ,present in the applicant object i created with standard platform.

share|improve this question

2 Answers 2

There is a lot to consider regarding what you want to do. This question is arguably pushing the boundaries of the "reasonable scope" suggestion when asking questions on stackexchange.

Some considerations you need to think of:

  1. How many search results might you ever get?
  2. Do you want to have pagination for large result sets
  3. Visualforce has a maximum 1000 records it can handle if the page is read/write
  4. If the page is read-only, consider using the read-only attribute in the page to get more results.
  5. The way you invoke SOQL will have to be dynamic using Database.query() and you'll need to construct the string based on which search parameters the user has set.
  6. You will want to make sure you escape single quotes on user entry to avoid SOQL injection
  7. Do you want to be able to sort results?
  8. What do you want to do with the results once you get them?

For things like pagination, consider the use of ApexPages.StandardSetController in your extension. This has a built in use of the QueryLocator class, which allows you to take advantage of an underlying database cursor for large results sets. There was a hands-on training at Dreamforce last year talking about the StandardSetController pattern (time index 1:54:00).

For learning about circumventing SOQL injection, you can read a little about it here in the Visualforce developer guide. But you will need dynamic SOQL, so make sure to use the escapeSingleQuotes() method for user-supplied search parameters.

share|improve this answer

You will first need to use a controller or extension with your vf page depending on your requirement(Assuming you are already using). Then you will need to associate an action fucnction with the search button.

In your controller you will need to have variables which you have bound with the inputText.

in your apex page tag:

<apex:page controller = "MyController"> or <apex:page standardController="Applicant__c" extensions= "MyController">

On the Button:

<apex:commandButton value="Search" action = "{!searchRecords}"/>

In the inputText Tag

<apex:inputText value="{!strSkillSet}"/> <apex:inputText value="{!strKeyWords}"/>...

in your controller:

public Class MyController{ string strSkillSet {get;set;} string strKeywords {get;Set;} // declare variables for others similarly }

and the below method

public List<Applicant__c> searchRecords(){ return [Select Id, Name from Applicant where yourfieldName =: strSkillSet and/or yourfieldName =:strKeyWords ...]; }

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.