How To Display Account Details With Similar Industry Records?

Salesforce Real Time Tasks:
Scenario:
             Some time we will get a requirement to Display the all the records in objects and whenever select one Record Then Display the Detail page of that Record and Show the Similar  Records with Same Industry Type.

Solution:

Visualforce Page:
<apex:page controller="rtt5">
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockButtons >
        <apex:commandButton value="Customer Direct Account" action="{!direct}"/>
        <apex:commandButton value="Customer - Channel Account" action="{!channel}"/>       
        </apex:pageBlockButtons>
       
            <apex:pageblocktable value="{!acts}" var="row" >
            <apex:column >
            <apex:commandLink value="{!row.name}" action="{!racts1}" rerender="abc">
                <apex:param value="{!row.id}" name="aid"/>
                <apex:param value="{!row.name}" name="aname"/>     
                 <apex:param value="{!row.industry}" name="aindustry"/>               
             </apex:commandLink>
            </apex:column>
            
              <apex:column value="{!row.type}"/>
               <apex:column value="{!row.industry}"/>
            </apex:pageblocktable>
       
           <apex:pageblocksection title="{!$CurrentPage.parameters.aname}" id="abc">
               <apex:detail subject="{!$CurrentPage.parameters.aid}"/>
                <apex:pageblocktable value="{!racts}" var="row"  >
              
              <apex:column value="{!row.Name}"/>
              <apex:column value="{!row.type}"/>             
               <apex:column value="{!row.industry}"/>
                </apex:pageblocktable>              
           </apex:pageblocksection>
           
    </apex:pageBlock>
</apex:form>
</apex:page>

Apex Controller:
public class rtt5{

    List<Account> r_acts;
   // string  type;
    List<Account> acts =  [SELECT name,type,industry,phone,ownerid FROM Account ];           
  
    public List<Account> getacts(){
            return acts;
    }
     public List<Account> getracts(){
            return r_acts ;
    }
  
    public PageReference direct(){
        //type = 'Customer - Direct';
            acts =  [SELECT name,type,industry,phone,ownerid FROM Account WHERE Type ='Customer - Direct']; 
          
        return null;
    }
    public PageReference channel(){
      // type = 'Customer - Channel';
             acts =  [SELECT name,type,industry,phone,ownerid FROM Account WHERE Type = 'Customer - Channel'];       
                return null;
    }
  
    public pagereference racts1(){
    r_acts =[SELECT  name,type,industry,phone,ownerid FROM Account WHERE Industry =: ApexPages.CurrentPage().getParameters().get('aindustry') ];
    return null;
    }
}

Result:

salesforce_real_time_scenarios

COMMENTS

Name

Apex Apex Default Methods Apex Methods Apex_Collections Apps Batch Apex Books CRM eBooks Data Import Wizard Data Management DataLoader Dataloader.io Difference Between Error in Salesforce FAQ's FAQ's-Apex FAQ's-Apps FAQ's-CRM FAQ's-Data loader FAQ's-SOQL & SOSL FAQ'S-Triggers FAQ's-User Profile & Security FAQ's-VF Force.com Explorer Force.com Ide Formulas & Functions Integration Interview Questions Only Latest_Updates Limits&Best Practices Online-Training Reports and Dashboards Salesforce Deployment Salesforce Realtime Examples On Development Salesforce Realtime Task On Admin Salesforce Realtime Tasks Salesforce Realtime Tasks- Apex Salesforce Training Salesforce1 Mobile Sites SOQL Spring'14 Release Triggers User Profile & Security VF Tags VisualForce Winter'14 Release Wizard for Accounts/Contacts Workbench Workflows and Approvals
false
ltr
item
Sfdc Gurukul- All in one place for salesforce and force.com step by step tutorial for beginners: How To Display Account Details With Similar Industry Records?
How To Display Account Details With Similar Industry Records?
How To Display Account Details With Similar Industry Records?,how to Display record information and it's details and industry,Display Account information with similar Industry,
http://3.bp.blogspot.com/-w_KeKRo4y7U/U0zWPE4KajI/AAAAAAAABtc/eYR7Gho50Kk/s1600/salesforce_real_time_scenarios.jpg
http://3.bp.blogspot.com/-w_KeKRo4y7U/U0zWPE4KajI/AAAAAAAABtc/eYR7Gho50Kk/s72-c/salesforce_real_time_scenarios.jpg
Sfdc Gurukul- All in one place for salesforce and force.com step by step tutorial for beginners
http://sfdcgurukul.blogspot.in/2014/04/how-to-display-account-details-with.html
http://sfdcgurukul.blogspot.in/
http://sfdcgurukul.blogspot.com/
http://sfdcgurukul.blogspot.com/2014/04/how-to-display-account-details-with.html
true
4199533888133360731
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy