• Padma Neela
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
My client asking me to change Printable View format, is there any waty to change it >
I have default list view i created one custom button called generate COA when click I getting all recored insted of selected. What is wrong in my code. 
VFP :  <apex:page standardController="FinishedGoods__c" extensions="GenerateCOA"
            recordSetVar="conferences">
<apex:stylesheet value="{!$Resource.pdfStyle}"/>
    <apex:pageBlock >
        <apex:pageBlockTable value="{!conferences}" var="c" border="2"   id="theTable"   >
        
            <apex:column value="{!c.Name}"  />
            <apex:column value="{!c.Lot_Number__c}"  />
          <apex:column value="{!c.Product_Name__c}"  />
             <apex:column value="{!c.Release_Date__c}"  />
            <apex:column value="{!c.Specifications__c}" />
            <apex:column value="{!c.Comments__c}" />
            <apex:column value="{!c.Product_Line__c}" />
            <apex:column value="{!c.Is_it_Rush__c}" />
           <apex:column value="{!c.Submitted_By__c}" />
             <apex:column value="{!c.Date_Received__c}"  />
       <apex:column value="{!c.Code__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
    
</apex:page>

Controler :
public class GenerateCOA {
 private ApexPages.StandardSetController standardSetController;
  public List<FinishedGoods__c> memList {get;set;}
   private Set<Id> memIds = new Set<Id>();
    public GenerateCOA(ApexPages.StandardSetController standardSetController)
    {
        this.standardSetController = standardSetController;
        
       
        memList = new List<FinishedGoods__c>();
        for (FinishedGoods__c mem : (List<FinishedGoods__c>)standardSetController.getSelected()){ 
             system.debug('mem.Id--->'+mem.Id); 
            memIds.add(mem.Id);
        }
        memList = [SELECT Id, Date_Received__c, Lot_Number__c, Product_Name__c, Release_Date__c, Comments__c, Product_Line__c, Is_it_Rush__c, Submitted_By__c, Specifications__c, Code__c, Name FROM FinishedGoods__c WHERE ID IN: memIds];
    }
    
    
 
    public PageReference doSomething()
    {
        // Apex code for handling records from a List View goes here
       // Id recordId = standardSetController.getId();
      //  system.debug('recordId'+recordId);
        List<FinishedGoods__c> selectedListViewRecords =
            (List<FinishedGoods__c>) standardSetController.getSelected();
        system.debug('Selected record id--->'+selectedListViewRecords[0].Id);
                return null;
    }
}


User-added image
I have default list view i created one custom button called generate COA when click I getting all recored insted of selected. What is wrong in my code. 
VFP :  <apex:page standardController="FinishedGoods__c" extensions="GenerateCOA"
            recordSetVar="conferences">
<apex:stylesheet value="{!$Resource.pdfStyle}"/>
    <apex:pageBlock >
        <apex:pageBlockTable value="{!conferences}" var="c" border="2"   id="theTable"   >
        
            <apex:column value="{!c.Name}"  />
            <apex:column value="{!c.Lot_Number__c}"  />
          <apex:column value="{!c.Product_Name__c}"  />
             <apex:column value="{!c.Release_Date__c}"  />
            <apex:column value="{!c.Specifications__c}" />
            <apex:column value="{!c.Comments__c}" />
            <apex:column value="{!c.Product_Line__c}" />
            <apex:column value="{!c.Is_it_Rush__c}" />
           <apex:column value="{!c.Submitted_By__c}" />
             <apex:column value="{!c.Date_Received__c}"  />
       <apex:column value="{!c.Code__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
    
</apex:page>

Controler :
public class GenerateCOA {
 private ApexPages.StandardSetController standardSetController;
  public List<FinishedGoods__c> memList {get;set;}
   private Set<Id> memIds = new Set<Id>();
    public GenerateCOA(ApexPages.StandardSetController standardSetController)
    {
        this.standardSetController = standardSetController;
        
       
        memList = new List<FinishedGoods__c>();
        for (FinishedGoods__c mem : (List<FinishedGoods__c>)standardSetController.getSelected()){ 
             system.debug('mem.Id--->'+mem.Id); 
            memIds.add(mem.Id);
        }
        memList = [SELECT Id, Date_Received__c, Lot_Number__c, Product_Name__c, Release_Date__c, Comments__c, Product_Line__c, Is_it_Rush__c, Submitted_By__c, Specifications__c, Code__c, Name FROM FinishedGoods__c WHERE ID IN: memIds];
    }
    
    
 
    public PageReference doSomething()
    {
        // Apex code for handling records from a List View goes here
       // Id recordId = standardSetController.getId();
      //  system.debug('recordId'+recordId);
        List<FinishedGoods__c> selectedListViewRecords =
            (List<FinishedGoods__c>) standardSetController.getSelected();
        system.debug('Selected record id--->'+selectedListViewRecords[0].Id);
                return null;
    }
}


User-added image

I'm looking for an alternative to passing selected records from a List View via the URL.  Here is how I'm currently doing it, but I'm running into IE URL limits when more than 100 records are selected.  This is a custom List view button executing JavaScript.

 

var ids = {!GETRECORDIDS( $ObjectType.Account )};

if(ids.length < 1 ) {
alert('Please select at least one Account.')
}
else {
// window.open('/apex/Quick_Email?rec='+ids.join(',')+'&retURL=001/o');
window.location='/apex/Quick_Email?rec='+ids.join(',')+'&retURL=001/o';
}

 

What other methods could I implement?

 

  • August 15, 2011
  • Like
  • 0