• subhash Beniwal
  • NEWBIE
  • 55 Points
  • Member since 2018

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi All..

I am new to development So I need help. i have one requirement where I have to select record type for Acoount from drop down and based on record type it should return accounts created under same record type in table without refreshing complete page. Morever I should have pagination for those returned account records.

Visualforce Page:

<apex:page controller="RecordTypeAccounts" title="Find the Accounts of corresponding record type" sidebar="False">

    <apex:form >

          <apex:pageBlock >

            <apex:pageBlockSection id="selectedRecordType" columns="1">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Choose Record Type for Account" for="rt" />         
                    <apex:panelGrid columns="2">
                    <apex:selectList value="{!RecordType}" multiselect="false"  size="1">
                        <apex:selectOptions value="{!rectypes}"/>
                        <apex:actionSupport event="onchange" action="{!getAccList}" reRender="Account_list"/>
                    </apex:selectList>              
                    </apex:panelGrid>       
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection> 
        <apex:pageBlockTable value="{!AccList}" var="item" id="Account_list">

            <apex:column value="{!item.name}"/>
            
            <apex:column value="{!item.rating}"/>
            
            <apex:column value="{!item.phone}"/>
            
            <apex:column >
                <apex:commandLink value="Click here" action="{!detailPage}">
                    <apex:param name="abc" value="{!item.id}" />
                </apex:commandLink>                              
            </apex:column>
            
                   <apex:panelGrid columns="8" id="PanelId">

         <apex:commandLink action="{!AccPagination.previous}" rerender="Account_list">

                <apex:outputLabel value="<<Previous" style="font-weight: bold;"/>

                </apex:commandlink>

                <apex:commandLink action="{!AccPagination.next}" rerender="Account_list">

                     <apex:outputLabel value="Next>>" style="font-weight: bold;"/>

                  </apex:commandlink>

          </apex:panelGrid> 

        </apex:pageBlockTable>
        

    </apex:pageBlock>
                     
            
    </apex:form>


</apex:page>

Controller :

public class RecordTypeAccounts {

    public string showaccid { get; set; }

    String recType;    
    
    public List<Account> AccList {get;set;}
    
    public List<SelectOption> getrectypes() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('','--Select Record Type --'));
        for(RecordType rt:[select id,name from RecordType where sobjecttype='Account']){
            options.add(new SelectOption(rt.id,rt.name));    
    }
        return options;
    }
    
    public String getRecordType() {
        return recType;
    }
    
    public void setRecordType(String recType) {
        this.recType= recType;
    }
  
public ApexPages.StandardSetController AccPagination
{        
        get{            
            if(AccPagination== null)
            {          
                AccPagination= new ApexPages.StandardSetController(Database.getQueryLocator([select name,rating,phone from account where recordtypeid =: recType]));            
            }           
        return AccPagination;        
            }        
        set;    
}    

   Public List<Account> getAcclist()
    {
     AccPagination.setPageSize(5);
     return (List<Account>) AccPagination.getRecords();
    
    }
   
 public PageReference detailPage() {
   
        showaccid  = System.currentPageReference().getParameters().get('abc');
        PageReference nextPage = new PageReference('/' + showaccid);
        nextPage.setRedirect(true);
        return nextPage;
}
}

 
Hi Friends, I have created a workflow rule In which Iam sending email alerts to recipient based on status. If status is "hot" the 
email alert is firing. But the reqirement is that particular lead URL also should be sent in the email,so that they
can easily click on that link and open that lead easily.
Need help. Thanks
  • June 04, 2018
  • Like
  • 0
Hi All..

I am new to development So I need help. i have one requirement where I have to select record type for Acoount from drop down and based on record type it should return accounts created under same record type in table without refreshing complete page. Morever I should have pagination for those returned account records.

Visualforce Page:

<apex:page controller="RecordTypeAccounts" title="Find the Accounts of corresponding record type" sidebar="False">

    <apex:form >

          <apex:pageBlock >

            <apex:pageBlockSection id="selectedRecordType" columns="1">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Choose Record Type for Account" for="rt" />         
                    <apex:panelGrid columns="2">
                    <apex:selectList value="{!RecordType}" multiselect="false"  size="1">
                        <apex:selectOptions value="{!rectypes}"/>
                        <apex:actionSupport event="onchange" action="{!getAccList}" reRender="Account_list"/>
                    </apex:selectList>              
                    </apex:panelGrid>       
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection> 
        <apex:pageBlockTable value="{!AccList}" var="item" id="Account_list">

            <apex:column value="{!item.name}"/>
            
            <apex:column value="{!item.rating}"/>
            
            <apex:column value="{!item.phone}"/>
            
            <apex:column >
                <apex:commandLink value="Click here" action="{!detailPage}">
                    <apex:param name="abc" value="{!item.id}" />
                </apex:commandLink>                              
            </apex:column>
            
                   <apex:panelGrid columns="8" id="PanelId">

         <apex:commandLink action="{!AccPagination.previous}" rerender="Account_list">

                <apex:outputLabel value="<<Previous" style="font-weight: bold;"/>

                </apex:commandlink>

                <apex:commandLink action="{!AccPagination.next}" rerender="Account_list">

                     <apex:outputLabel value="Next>>" style="font-weight: bold;"/>

                  </apex:commandlink>

          </apex:panelGrid> 

        </apex:pageBlockTable>
        

    </apex:pageBlock>
                     
            
    </apex:form>


</apex:page>

Controller :

public class RecordTypeAccounts {

    public string showaccid { get; set; }

    String recType;    
    
    public List<Account> AccList {get;set;}
    
    public List<SelectOption> getrectypes() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('','--Select Record Type --'));
        for(RecordType rt:[select id,name from RecordType where sobjecttype='Account']){
            options.add(new SelectOption(rt.id,rt.name));    
    }
        return options;
    }
    
    public String getRecordType() {
        return recType;
    }
    
    public void setRecordType(String recType) {
        this.recType= recType;
    }
  
public ApexPages.StandardSetController AccPagination
{        
        get{            
            if(AccPagination== null)
            {          
                AccPagination= new ApexPages.StandardSetController(Database.getQueryLocator([select name,rating,phone from account where recordtypeid =: recType]));            
            }           
        return AccPagination;        
            }        
        set;    
}    

   Public List<Account> getAcclist()
    {
     AccPagination.setPageSize(5);
     return (List<Account>) AccPagination.getRecords();
    
    }
   
 public PageReference detailPage() {
   
        showaccid  = System.currentPageReference().getParameters().get('abc');
        PageReference nextPage = new PageReference('/' + showaccid);
        nextPage.setRedirect(true);
        return nextPage;
}
}

 
Hi Friends, I have created a workflow rule In which Iam sending email alerts to recipient based on status. If status is "hot" the 
email alert is firing. But the reqirement is that particular lead URL also should be sent in the email,so that they
can easily click on that link and open that lead easily.
Need help. Thanks
  • June 04, 2018
  • Like
  • 0