• Hanumantha Rao 6
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Hi Folks,

can u pls explain how to pass selected record ids in another visualforce page 
Explanation : i have created a vf page dispalying the opportunity related products ,for this using wrapper class so if i select any record and click on the save button it will redirect to another page called:downloadpdf " page , in this page iam downloading pdf file, in this pdf file am unable to display the selected records information  in pdf file , pls find the below  code and pls do any modifications its very urgnt
VF PAGE : 

  
 
 
Hi I have a requirement please find the below ,

REQ : Create a new Button on Opportunity detail page, once user click on the button need to show the Product records in the vf page with input check box in front of the each record.
Once user selects records and click on save leads to download the PDF document based on Product Type
 
Ex: if user selects 10 Products and these are associated to 3 different product types, 3 PDF files has to be generated and download in to local system.
 
Work around : i have created VF page for  dispalying all products and this VF page  created a button called Save Lead, in this VF page i selected 3 records based on the product type and i click the save lead button ,automatically PDF has to be generated ,only 1 pdf file generated ,but i selected 3 records.
Example: if i select 3 records in VF page 3 files has to be generate ------> but my code it work only download 1 pdf file, please find the below code and please suggest me where am missing or anyone done already this requirement pls send the code, i have checked all the blogs but no luck 
VF Page : 

 
     
     
     
     
         
           
               
           
           
               
           
           
               
           
         
     
 


Controller :
public class ProductPDFController  {

 id oppid;
    //Our collection of the class/wrapper objects ProductWrapper 
    public List Product2List {get; set;}
     public ProductPDFController (){
       oppid = System.currentPageReference().getParameters().get('oppid');   
    }
    //This method uses a simple SOQL query to return a List of Product2s
    public List getProducts() {
        if(Product2List == null) {
            Product2List = new List();
            for(Product2 c: [SELECT Id, Family, IsActive, ProductCode, Name FROM Product2 where Id=:oppid AND isactive=true AND ID IN (select product2id from opportunityLineItem where product2id!=null)]) {
                // As each Product2 is processed we create a new ProductWrapper object and add it to the Product2List
                Product2List.add(new ProductWrapper(c));
            }
        }
        return Product2List;
    }


    public pagereference Download() {
    set selectedTypes = new set();
                //We create a new list of Product2s that we be populated only with Product2s if they are selected
        List selectedProduct2s = new List();

        //We will cycle through our list of ProductWrappers and will check to see if the selected property is set to true, if it is we add the Product2 to the selectedProduct2s list
        for(ProductWrapper cCon: Product2List) {
            if(cCon.selected == true) {
                selectedProduct2s.add(cCon.con);
            }
        }

        // Now we have our list of selected Product2s and can perform any type of logic we want, sending emails, updating a field on the Product2, etc
        System.debug('These are the selected Product2s...');
        for(Product2 con: selectedProduct2s) {
            system.debug(con);
            selectedTypes.add(con.family);
        }
        Product2List=null; // we need this line if we performed a write operation  because getProduct2s gets a fresh list now
        Pagereference pageref;
        pageref = page.downloadpdf;
        pageRef.getParameters().put('recordsize',string.valueof(selectedTypes.size()));
         pageref.setRedirect(false);
        return pageref;
    }


    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Product2 and a Boolean value
    public class ProductWrapper {
        public Product2 con {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new ProductWrapper object we pass a Product2 that is set to the con property. We also set the selected value to false
        public ProductWrapper(Product2 c) {
            con = c;
            selected = false;
        }
    }
}

Download VF page : 

 

PDF Download example



Controller :
public with sharing class contactquery {
public string renderAs{get;set;}    
    public contactquery(){
    //figure out if the user passed in the pdf url variable and if it is set to true.
    integer size = integer.valueof(ApexPages.currentPage().getParameters().get('recordsize'));
    for(integer i=1;i        runmethod(i); 
     }
    }
    public void runmethod(integer i){
        renderAs = 'pdf';
        string fileName = 'My PDF Report '+date.today()+'.pdf';
        Apexpages.currentPage().getHeaders().put('content-disposition', 'attachment; filename='+fileName+'('+i+')');
            
    }
}

 
Hi Folks,

I have  a requirement please see the below and suggest me 

I have created a custom field in Account object ,  which is text field name = Grand Parent Account(custom field), it has to update the highest parent Account name in the heirachy.
A->B->C->D-> ------- upto -->S

now i have created Account A user has to select B as parent Account(which is statndard field) now i need to update the highest parent account in the custom field.

please suggest me or if any one achieve the same requirement through trigger pls forward the code to my email id  " hanu.akki@gmail.com "

Thanks in Advance
Hanu
Hi i have a requirement please find the below req and suugget me , or send my any related code is already developed .

Display all related opp records for a particualr account with the below conditions
1) Opportunities which are status= TRUE 
2) These Opportunities should have at least one Product.
3) This VF page should support Pagination, each page should have max of 25 record.
This VF page should have sorting in all the columns.
4) VF page should have i/p check box has to be present in front of every record.


i developed VF page for pagination for displaying account records but dont know how to to display one account related opportunities , please help me on this or send any code 

Regards,
Hanu
Hi Folks,

can u pls explain how to pass selected record ids in another visualforce page 
Explanation : i have created a vf page dispalying the opportunity related products ,for this using wrapper class so if i select any record and click on the save button it will redirect to another page called:downloadpdf " page , in this page iam downloading pdf file, in this pdf file am unable to display the selected records information  in pdf file , pls find the below  code and pls do any modifications its very urgnt
VF PAGE : 

  
 
 
Hi I have a requirement please find the below ,

REQ : Create a new Button on Opportunity detail page, once user click on the button need to show the Product records in the vf page with input check box in front of the each record.
Once user selects records and click on save leads to download the PDF document based on Product Type
 
Ex: if user selects 10 Products and these are associated to 3 different product types, 3 PDF files has to be generated and download in to local system.
 
Work around : i have created VF page for  dispalying all products and this VF page  created a button called Save Lead, in this VF page i selected 3 records based on the product type and i click the save lead button ,automatically PDF has to be generated ,only 1 pdf file generated ,but i selected 3 records.
Example: if i select 3 records in VF page 3 files has to be generate ------> but my code it work only download 1 pdf file, please find the below code and please suggest me where am missing or anyone done already this requirement pls send the code, i have checked all the blogs but no luck 
VF Page : 

 
     
     
     
     
         
           
               
           
           
               
           
           
               
           
         
     
 


Controller :
public class ProductPDFController  {

 id oppid;
    //Our collection of the class/wrapper objects ProductWrapper 
    public List Product2List {get; set;}
     public ProductPDFController (){
       oppid = System.currentPageReference().getParameters().get('oppid');   
    }
    //This method uses a simple SOQL query to return a List of Product2s
    public List getProducts() {
        if(Product2List == null) {
            Product2List = new List();
            for(Product2 c: [SELECT Id, Family, IsActive, ProductCode, Name FROM Product2 where Id=:oppid AND isactive=true AND ID IN (select product2id from opportunityLineItem where product2id!=null)]) {
                // As each Product2 is processed we create a new ProductWrapper object and add it to the Product2List
                Product2List.add(new ProductWrapper(c));
            }
        }
        return Product2List;
    }


    public pagereference Download() {
    set selectedTypes = new set();
                //We create a new list of Product2s that we be populated only with Product2s if they are selected
        List selectedProduct2s = new List();

        //We will cycle through our list of ProductWrappers and will check to see if the selected property is set to true, if it is we add the Product2 to the selectedProduct2s list
        for(ProductWrapper cCon: Product2List) {
            if(cCon.selected == true) {
                selectedProduct2s.add(cCon.con);
            }
        }

        // Now we have our list of selected Product2s and can perform any type of logic we want, sending emails, updating a field on the Product2, etc
        System.debug('These are the selected Product2s...');
        for(Product2 con: selectedProduct2s) {
            system.debug(con);
            selectedTypes.add(con.family);
        }
        Product2List=null; // we need this line if we performed a write operation  because getProduct2s gets a fresh list now
        Pagereference pageref;
        pageref = page.downloadpdf;
        pageRef.getParameters().put('recordsize',string.valueof(selectedTypes.size()));
         pageref.setRedirect(false);
        return pageref;
    }


    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Product2 and a Boolean value
    public class ProductWrapper {
        public Product2 con {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new ProductWrapper object we pass a Product2 that is set to the con property. We also set the selected value to false
        public ProductWrapper(Product2 c) {
            con = c;
            selected = false;
        }
    }
}

Download VF page : 

 

PDF Download example



Controller :
public with sharing class contactquery {
public string renderAs{get;set;}    
    public contactquery(){
    //figure out if the user passed in the pdf url variable and if it is set to true.
    integer size = integer.valueof(ApexPages.currentPage().getParameters().get('recordsize'));
    for(integer i=1;i        runmethod(i); 
     }
    }
    public void runmethod(integer i){
        renderAs = 'pdf';
        string fileName = 'My PDF Report '+date.today()+'.pdf';
        Apexpages.currentPage().getHeaders().put('content-disposition', 'attachment; filename='+fileName+'('+i+')');
            
    }
}

 
Hi i have a requirement please find the below req and suugget me , or send my any related code is already developed .

Display all related opp records for a particualr account with the below conditions
1) Opportunities which are status= TRUE 
2) These Opportunities should have at least one Product.
3) This VF page should support Pagination, each page should have max of 25 record.
This VF page should have sorting in all the columns.
4) VF page should have i/p check box has to be present in front of every record.


i developed VF page for pagination for displaying account records but dont know how to to display one account related opportunities , please help me on this or send any code 

Regards,
Hanu