anusha(salesforce developer)

Sunday, 12 June 2016

Visualforce Page Senario

1)Develop a search text page on top .
Once you search for the name of the account it should display all the records related to the name??
Using Visual Pages

2)I have couple of pages in an application
Says as page1 ,page2,page3,page4,page5.All the five pages are having same content as footer and header??
when i add some sentences on page 1 ,it should appear in all the pages .How can u achieve this??
Using Visual Pages


3)I want a to create a visual page and it should be a Search page,when i select the country / language it should display me the page in particular language??
how can i achieve this using a static header??


search code

<apex:page controller="theController">
   <apex:form >
      <apex:pageBlock mode="edit" id="block">
         <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
               <apex:outputLabel for="searchText">Search Text</apex:outputLabel>
               <apex:panelGroup >
                  <apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Go!" action="{!doSearch}"
                                      rerender="block" status="status"/>
               </apex:panelGroup>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="requesting..."/>
        <apex:pageBlockSection title="Results" id="results" columns="1">
           <apex:pageBlockTable value="{!results}" var="l"
                               rendered="{!NOT(ISNULL(results))}">
              <apex:column value="{!l.name}"/>
              <apex:column value="{!l.email}"/>
              <apex:column value="{!l.phone}"/>
           </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>


apex class

public class theController {

    String searchText;
    List<Lead> results;

    public String getSearchText() {
        return searchText;
    }

    public void setSearchText(String s) {
        searchText = s;
    }

    public List<Lead> getResults() {
        return results;
    }

    public PageReference doSearch() {
        results = (List<Lead>)[FIND :searchText RETURNING Lead(Name, Email, Phone)][0];
        return null;
    }
}

Please share ur ideas if it is helpful means.....

1 comment:

  1. Hi,

    You can go through cook having good code samples and you can participate in discussion boards to share and update your knowledge.

    http://developer.force.com/cookbook/

    For the questions you have

    1) You go through Apex book like
    http://www.salesforce.com/us/developer/docs/apexcode/index.htm
    2) We can’t say commonly used area like that, but conditional statements (if, for..), Collections(set, list,map), Property variables(getter settes), test methods, etc will be used commonly to write any code.

    ReplyDelete