• Kiran Kumar 77
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
Ho to share the all opportunty records from Salesforce orgA to salesforce org B using Batch class..
If you have any code can you please share me..

Hi Iam trying to do paination using offset keyword next button is working but previous button in not working..


<apex:page controller="trpaginationoffsetContrller">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:pageBlockTable value="{!ConList}" var="con">
                    <apex:column value="{!con.Name}"/>
                    <apex:column >
                        <table  width="100%">                
                  <apex:repeat value="{!ConList}" var="ContactSelec">
                  <tr><td>{!ContactSelec.FirstName}</td> <td>{!ContactSelec.LastName }</td></tr>
                  </apex:repeat>
                  </table>
                    </apex:column>
                   
                </apex:pageBlockTable>
            </apex:pageBlockSection>
           
            <apex:commandButton value="Previous" action="{!Previous}"/>
           
           
            <apex:commandButton value="Next" action="{!Next}"/>
           
        </apex:pageBlock>
    </apex:form> 
</apex:page>

--------------------------------------------------------------------------------------------

public class trpaginationoffsetContrller {
    public List<Contact> ConList {get;set;}
    public Integer Counter = 0;
    public trpaginationoffsetContrller(){
       
        //ConList = new List<Contact>
        ConList = [select Id, Name,FirstName, LastName  from Contact ORDER BY name Limit 10 OFFSET 0];
    }
    public void Next(){
        Counter ++;
        //ConList = new List<Contact>
        ConList = [select Id, Name,FirstName, LastName from contact ORDER BY name
                   Limit 10 OFFSET 10
                  ];
        update ConList;
    }
    public void Previous(){
        counter --;
        conList = [select Id, Name,FirstName, LastName from Contact ORDER BY name limit 50 OFFSET 10]; 
        update ConList;
    }
}
and can you help me Account Names diplay its related contacts only in VF page
I have on requirement :
I want to retrive the contact records which are related to account, I wrote standardset controller but i am uanable to display the records i Visualforce Page
Can you please help me;
<apex:page controller="TrAccountrelatedContacrs">
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockSection >
              <apex:pageBlockTable value="{!conList}" var="i">
                  <apex:column value="{!i.cat.Name}"/>
              </apex:pageBlockTable>
              <!--<apex:pageBlockTable value="{!cont}" var="co">
                  <apex:column value="{!co.name}"/>
              </apex:pageBlockTable>-->
          </apex:pageBlockSection>
      </apex:pageBlock>
     
  </apex:form>
</apex:page>
----------------------------------------------------------------
Controlller:
public class TrAccountrelatedContacrs {
    public List<AccountWrapper>  conList = new List<AccountWrapper>();
    //List<Account> conList {get;set;}
   
    public ApexPages.StandardSetController con {
        get{
            if(con==null){
                con = new ApexPages.StandardSetController(Database.getQueryLocator([select id, Account.name,(select Name,Contact.FirstName,Contact.LastName from account.Contacts) from Account limit 100]));
                system.debug('############'+con);
                con.setPagesize(10);
            }
            return con;
        }
        set;
    }
    public List<AccountWrapper> getconList(){
        conList = new List<AccountWrapper>();
        for(Account e : (List<Account>)con.getRecords())
            conList.add(new AccountWrapper(e));// 
        return conList;
    }
    public Boolean hasNext {
        get{
            return con.getHasNext();
        }
        set;
    }
    public Boolean hasPrevious{
        get{
            return con.getHasPrevious();           
    }
    set;
    }
    public Integer PageNumber{
        get{
            return con.getPageNumber();
        }
        set;
    }
    public void first(){
        con.first();
    }
    public void last(){
        con.last();
    }
    public void previous(){
        con.previous();
    }
    public void next(){
        con.next();
    }
    public void cancel(){
        con.cancel();
    }
   
    public class AccountWrapper {
        public boolean checked {get;set;}
        public Account cat {get;set;}
        public AccountWrapper(){
            cat = new Account();
            checked = false;
        }
        public AccountWrapper(Account c){
          cat =c;
          checked = false;
        }
    }
    public class ContactWrapper{
        public contact cont {get;set;}
        public ContactWrapper(contact e){
           cont = new contact();
        }
    }

}

Thanks in Advance

Ho to share the all opportunty records from Salesforce orgA to salesforce org B using Batch class..
If you have any code can you please share me..

I have on requirement :
I want to retrive the contact records which are related to account, I wrote standardset controller but i am uanable to display the records i Visualforce Page
Can you please help me;
<apex:page controller="TrAccountrelatedContacrs">
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockSection >
              <apex:pageBlockTable value="{!conList}" var="i">
                  <apex:column value="{!i.cat.Name}"/>
              </apex:pageBlockTable>
              <!--<apex:pageBlockTable value="{!cont}" var="co">
                  <apex:column value="{!co.name}"/>
              </apex:pageBlockTable>-->
          </apex:pageBlockSection>
      </apex:pageBlock>
     
  </apex:form>
</apex:page>
----------------------------------------------------------------
Controlller:
public class TrAccountrelatedContacrs {
    public List<AccountWrapper>  conList = new List<AccountWrapper>();
    //List<Account> conList {get;set;}
   
    public ApexPages.StandardSetController con {
        get{
            if(con==null){
                con = new ApexPages.StandardSetController(Database.getQueryLocator([select id, Account.name,(select Name,Contact.FirstName,Contact.LastName from account.Contacts) from Account limit 100]));
                system.debug('############'+con);
                con.setPagesize(10);
            }
            return con;
        }
        set;
    }
    public List<AccountWrapper> getconList(){
        conList = new List<AccountWrapper>();
        for(Account e : (List<Account>)con.getRecords())
            conList.add(new AccountWrapper(e));// 
        return conList;
    }
    public Boolean hasNext {
        get{
            return con.getHasNext();
        }
        set;
    }
    public Boolean hasPrevious{
        get{
            return con.getHasPrevious();           
    }
    set;
    }
    public Integer PageNumber{
        get{
            return con.getPageNumber();
        }
        set;
    }
    public void first(){
        con.first();
    }
    public void last(){
        con.last();
    }
    public void previous(){
        con.previous();
    }
    public void next(){
        con.next();
    }
    public void cancel(){
        con.cancel();
    }
   
    public class AccountWrapper {
        public boolean checked {get;set;}
        public Account cat {get;set;}
        public AccountWrapper(){
            cat = new Account();
            checked = false;
        }
        public AccountWrapper(Account c){
          cat =c;
          checked = false;
        }
    }
    public class ContactWrapper{
        public contact cont {get;set;}
        public ContactWrapper(contact e){
           cont = new contact();
        }
    }

}

Thanks in Advance