function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Regarding search query

I am new to salesforce . i want to  search  all the fields related to  custom object (Candidate__c ) by using search keyword

This is my search controller code


public  with sharing class searchcontroller{
    public String mysearchtext {get; set;}

    public void dosearch()
        pagereference p = apexpages.Currentpage();
        apexpages.Message msg = new Apexpages.Message(ApexPages.Severity.Info,'My Search Text : ' + (mysearchtext));
         //***** search logic ****//


please help me with the code

Thanks in advance

public with sharing class FindServiceTicketController{
  private ApexPages.StandardController controller {get; set;}
  public List<ServiceTicket__c> searchResults {get;set;}
  public string searchText {get;set;}
  // standard controller - could also just use custom controller
  public FindServiceTicketController(ApexPages.StandardController controller) { }
  // fired when the search button is clicked
  public PageReference search() {
    String qry = 'select Name , EmpID__c , Period__c , SalesOrderNo__c  from ServiceTicket__c   ' +
      'where EmpName__c  LIKE \'%'+searchText+'%\' ';
    searchResults = Database.query(qry);
      return null;

Trinay Technologies