Activity Forums Salesforce® Discussions how to display the result of sosl in Salesforce Visualforce page?

  • Vikas Kumar

    Member
    February 8, 2017 at 12:45 pm

    Hi gaurav;

    you can do something like this

    <apex:page StandardController="Contact" extensions="tstpopup1">

    <apex:form>

    <apex:commandButton action="{!runQuery}" value="Go"/>

    <apex:pageBlock >
    <apex:pageBlockSection columns="1">
    <apex:pageBlockTable value="{!accounts}" var="account">
    <apex:column headerValue="Name" value="{!account.name}/>
    <apex:column headerValue="Street" value="{!account.BillingStreet}"/>
    <apex:column headerValue="City" value="{!account.BillingCity}"/>
    <apex:column headerValue="Postcode" value="{!account.BillingPostalCode}"/>
    </apex:pageBlockTable>
    </apex:pageBlockSection>
    </apex:pageBlock>

    </apex:form>

    </apex:page>

    controller

    public with sharing class tstpopup1 {

    public List<Account> accounts {get; set;}

    public tstpopup1(ApexPages.StandardController str){
    accounts=new List<Account>();
    }

    public void runQuery() {
    List<List<Account>> searchResults=[FIND '1234'IN ALL FIELDS RETURNING Account (id, name, billingstreet, billingcity, billingpostalcode)];
    accounts=searchResults[0];
    //return null;
    }

    }

     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos