• Ali Husain 3
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 7
    Replies
Most of my scenario is complete but am having difficulities with a few areas (bottom of post).

I have a custom object Deal_Reg__c. The business flow for this object is that a user can go to this object's page and add a Product to this Deal Reg (related list of DealRegistrationProducts). I have created a junction object called Deal_Reg_Products__c that has a Deg Reg Lookup as well as a Product Lookup along with other custom fields. After you press the "Add" button on the Deal Reg Products Related List section of the Deal Reg page, i would like the first VF page to be displayed.

The first VF page should basically only be a selectable list of all the Products with the name of the Deal_Reg__c that we were coming from. After the user selects one or multiple records to add to the specific Deal Reg, they will press a button called "Add Product". Pressing that button should fire off the second VF page.

The second VF page should consist of the selected list of Products from the first VF page along with a Deal_Reg_Products__c.Forecast_Amount__c custom field, "Forecast Amount", next to each record where the user can input the value. After a value has been entered for each Product, the user will press a "Confirm" button which will send us back to the Deal Reg page where in the Deal Reg Products Related List section the selected Products are now visible with the Forecast Amount we entered and are now tied to that Deal Reg.

1. I would like to have a cancel button on both the visualforce pages. How can i get back to the original deal_reg__c?
public id dealregId;

public pageReference cancel(){
        return new PageReference('/'+dealregId);
    }
I though that this would work, but i get directed to a page with the error: URL No Longer Exists
The URL has now changed to: https://cs10.salesforce.com/null
 
Most of my scenario is complete but am having difficulities with a few areas (bottom of post).

I have a custom object Deal_Reg__c. The business flow for this object is that a user can go to this object's page and add a Product to this Deal Reg (related list of DealRegistrationProducts). I have created a junction object called Deal_Reg_Products__c that has a Deg Reg Lookup as well as a Product Lookup along with other custom fields. After you press the "Add" button on the Deal Reg Products Related List section of the Deal Reg page, i would like the first VF page to be displayed.

The first VF page should basically only be a selectable list of all the Products with the name of the Deal_Reg__c that we were coming from. After the user selects one or multiple records to add to the specific Deal Reg, they will press a button called "Add Product". Pressing that button should fire off the second VF page.

The second VF page should consist of the selected list of Products from the first VF page along with a Deal_Reg_Products__c.Forecast_Amount__c custom field, "Forecast Amount", next to each record where the user can input the value. After a value has been entered for each Product, the user will press a "Confirm" button which will send us back to the Deal Reg page where in the Deal Reg Products Related List section the selected Products are now visible with the Forecast Amount we entered and are now tied to that Deal Reg.

Here is my code for VF1:
<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController" tabstyle="Deal_Reg__c" id="myPage" recordSetVar="Deal_Registration_Products__r">
    <apex:form id="myForm">
       <!-- <apex:pageBlock title="Edit Account for {!$Deal_Reg__c.id}">
        </apex:pageBlock> -->
        <br/>
        <br/>
        <apex:pageBlock title="Find Products" id="mypageBlock">
            <table width="100%">
                <tr>
                    <td width="25%" align="right">
                        <apex:pageBlockSection columns="1">
                            <b>By Keyword </b><br/>
                            <apex:inputText value="{!inputText1}" html-placeholder="Product Name"/>
                            <apex:commandButton value="Search" action="{!searchProduct}"/>   
                        </apex:pageBlockSection>
                    </td>
                </tr>
            </table>
            <br/>
            <p/>
        </apex:pageBlock>
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Add Products" action="{!DisplayDetails}"/>
            </apex:pageBlockButtons>
            <!-- In our table we are displaying the cProduct records -->
            <apex:pageBlockTable value="{!products}" var="p" id="table">
                <apex:column >
                    <!-- This is our selected Boolean property in our wrapper class -->
                    <apex:inputCheckbox value="{!p.selected}"/>
                </apex:column>
                <!-- This is how we access the contact values within our cProduct container/wrapper -->
                <apex:column value="{!p.prod.Name}" />
                <apex:column value="{!p.prod.ProductCode}" />
                <apex:column value="{!p.prod.Description}" />
                <apex:column value="{!p.prod.Family}" />
            </apex:pageBlockTable>
            <apex:outputLabel >{!SelectedProd}</apex:outputLabel>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Here is my code for VF2:
<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController" recordSetVar="products">
   <apex:form >
       <apex:pageBlock title="Deal Registration Products">
            <apex:pageBlockButtons >
                <apex:commandButton value="Confirm"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!selectedproductList}" var="p">
                <apex:column value="{!p.prod.Name}" headerValue="Product"/>
                <apex:column headerValue="Forecast Amount">
                    <apex:inputText value="{!p.forecastAmount}" />
                </apex:column> 
                <!-- <apex:column headerValue="Forecast Amount2">
                    <apex:inputText value="{!p.prod.Deal_Registration_Products__r}" />
                </apex:column>  -->
            </apex:pageBlockTable> 
            <apex:outputPanel >
                <apex:outputLabel >{!selectedproductList}</apex:outputLabel> 
            </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>  
</apex:page>

And here is my controller:
public with sharing class wrapperClassController {

    public wrapperClassController(ApexPages.StandardSetController controller) {

    }


    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
            
                    setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            system.debug('setConSize-----'+setCon.getResultSize());
            return setCon;
        }
        set;
    }
    
    public String inputText1 {get;set;}
    public String productName {get;set;}
    public Boolean isListEmpty {get;set;}
    public List<cProduct2> productWrapperlist = new List<cProduct2>();
    public List<List<cProduct2>> listOfProductWrapperlist = new List<List<cProduct2>>();
    public Deal_Registration_Products__c dealRegProds;
    
    //Our collection of the class/wrapper objects cProduct2 
    public List<cProduct2> productList {get; set;}
    public List<cProduct2> selectedproductList {get; set;}
    public List<Product2> selectedProducts {get; set;}
    public List<Product2> selectedProd = new List<Product2>();

    //This method uses a simple SOQL query to return a List of Products
    public List<cProduct2> getProducts() {
        if(productList == null) {
            productList = new List<cProduct2>();
            for(Product2 p: [select Id, Name, ProductCode, Description, Family from Product2 limit 100]) {
                // As each product is processed we create a new cProduct2 object and add it to the productList
                productList.add(new cProduct2(p));
            }
        }
        return productList;
    }


    public void processSelected() {

        //We create a new list of Products that we be populated only with Products if they are selected
        List<Product2> 
        selectedProducts = new List<Product2>();

        //We will cycle through our list of cProducts and will check to see if the selected property is set to true, if it is we add the Product to the selectedProducts list
        for(cProduct2 cProd: getProducts()) {
            if(cProd.selected == true) {
                selectedProducts.add(cProd.prod);
            }
        }

        // Now we have our list of selected products and can perform any type of logic we want, sending emails, updating a field on the Product, etc
        System.debug('These are the selected Products...');
        for(Product2 prod: selectedProducts) {
            system.debug(prod);
        }
        //productList=null; // we need this line if we performed a write operation  because getProducts gets a fresh list now
        //return null;
    }


    public List<cProduct2> getdealregProductsDetails()
    {
        //If there are records to be displayed then show the records else display message
        if((setCon.getResultSize()) > 0)
        {
            if(listOfProductWrapperlist[setCon.getPageNumber()-1].size() == 0) {
                productWrapperlist = new List<cProduct2>();
                for(Product2 p : (List<Product2>)setCon.getRecords()) {
                    productWrapperlist.add(new cProduct2(p));
                }
                listOfProductWrapperlist[setCon.getPageNumber()-1] = productWrapperlist;
            }
            system.debug('productWrapperlist-----'+productWrapperlist);
            return listOfProductWrapperlist[setCon.getPageNumber()-1];
        }
        else
        {
            return null;
        }           
    }
    // 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 Contact and a Boolean value
    public class cProduct2 {
        public Product2 prod {get; set;}
        public Boolean selected {get; set;}
        public String forecastAmount {get; set;}

        //This is the contructor method. When we create a new cProduct2 object we pass a Product that is set to the con property. We also set the selected value to false
        public cProduct2(Product2 p) {
            prod = p;
            selected = false;
        }
        
        public cProduct2(Product2 prd, boolean check) {
            prod = prd;
            selected = check;
        }
    }
    
    public class cDealRegProd {
        public Deal_Registration_Products__c dealRegProd {get; set;}
    }
        
    
    
    public void searchProduct() {
            system.debug('productName : '+productName);
            if(productName != null && productName != '') {
                setCon = new ApexPages.StandardSetController(Database.query('Select Id,Name,ProductCode,Description,Family from Product2 where Name like \'%'+productName+'%\' Order by Name limit 2000'));
                
            } else {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            listOfProductWrapperlist.clear();
            setCon.setPageSize(25);
            Integer reminder = math.mod(setCon.getResultSize(),setCon.getPageSize());
            Integer listToCreateSize = (reminder == 0?(setCon.getResultSize()/setCon.getPageSize()):(setCon.getResultSize()/setCon.getPageSize())+1);
            for(Integer i=0; i < listToCreateSize ; i++){
                listOfProductWrapperlist.add(new List<cProduct2>());
            }
            if(listOfProductWrapperlist== null || listOfProductWrapperlist.isEmpty()) {
                isListEmpty = true;
            }       
        }
            
    public List<Product2> getSelectedProd() {
        if(selectedProd.size()>0) {
            System.debug(' selectProd '+selectedProd);
            return selectedProd;
        }
        else
        return null;
    }
    
    public PageReference DisplayDetails() {
        selectedproductList = new List<cProduct2>();
        
        for(cProduct2 prd : productList) {
            if(prd.selected == true) {
                selectedproductList.add(prd);
            }
        }
        system.debug(selectedproductList);
        PageReference reRend = new PageReference('/apex/DealRegProducts');
        reRend.setRedirect(false);
        return reRend;
    }
    
    public List<cProduct2> getProdDetails() {
        productList = new List<cProduct2>();
        List<Product2> prods = [Select Id,Name,ProductCode,Description,Family from Product2 Order by Name];
        
        for(Product2 p : prods) {
            productList.add(new cProduct2(p, false));
        }
        return productList;
    }
    
    public List<cProduct2> getSelectProdDetails() {
        selectedproductList = new List<cProduct2>();
        
        for(cProduct2 c : getProdDetails()) {
            System.debug(' selectProdDetails ' + c);
            
            if(c.selected == true)
            selectedproductList.add(c);
        }
        return selectedproductList;
    }
}


How do i display the name of the Deal_Reg__c on the 1st VF page?
How do i tie the selected Products and entered Forecast Amount to the corresponding Deal Reg after pressing "Confirm" and have those values displayed in the Related List section of the Deal_Reg__c page?

Thanks,
I need to write a trigger on the OpportunityLineItem. Part of the funtionality will involve me getting to the User object. Can someone help me if figuring out how to map these objects?

Here is what it would look like in SQL:

SELECT UserID, Name, Business__c
FROM AccountTeamMember atm
INNER JOIN Account a ON a.ID = atm.AccountID
INNER JOIN Opportunity o ON o.AccountID = a.ID
INNER JOIN OpportunityLineItem oli ON oli.OpportunityID = o.ID
I have two VF pages. The first page is a list of Products. The user will select one or many Products and press a custom button. This will bring the user to the second VF page. This page displays a list of the Products they had previously selected. I would like to have an input field next to each Product where they can enter in the Forecast Amount (custom field on custom object). When i try doing that, i get the following error:

Error: Could not resolve the entity from <apex:inputField> value binding '{!p.Forecast_Amount__c}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.

Any idea how i can resolve this issue?

VF Page 2:

<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController" recordSetVar="products">
   <apex:form >
       <apex:pageBlock title="Deal Registration Products">
            <apex:pageBlockButtons >
                <apex:commandButton value="Confirm"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!selectedproductList}" var="p">
                <apex:column value="{!p.prod.Name}"/>
                <!-- <apex:column value="{!p.prod.Forecast_Amount__c}"/> -->
                <apex:column headerValue="Forecast Amount">
                    <apex:inputField value="{!p.Forecast_Amount__c}"/>
                </apex:column>
            </apex:pageBlockTable> 
            <apex:outputPanel >
                <apex:outputLabel >{!selectedproductList}</apex:outputLabel> 
            </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>  
</apex:page>


Contorller:

public with sharing class wrapperClassController {

    public wrapperClassController(ApexPages.StandardSetController controller) {

    }


    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
            
                    setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            system.debug('setConSize-----'+setCon.getResultSize());
            return setCon;
        }
        set;
    }
    
    public String inputText1 {get;set;}
    public String productName {get;set;}
    public Boolean isListEmpty {get;set;}
    public List<cProduct2> productWrapperlist = new List<cProduct2>();
    public List<List<cProduct2>> listOfProductWrapperlist = new List<List<cProduct2>>();
    public Deal_Registration_Products__c dealRegProds;
    
    //Our collection of the class/wrapper objects cProduct2 
    public List<cProduct2> productList {get; set;}
    public List<cProduct2> selectedproductList {get; set;}
    public List<Product2> selectedProducts {get; set;}
    public List<Product2> selectedProd = new List<Product2>();

    //This method uses a simple SOQL query to return a List of Products
    public List<cProduct2> getProducts() {
        if(productList == null) {
            productList = new List<cProduct2>();
            for(Product2 p: [select Id, Name, ProductCode, Description, Family from Product2 limit 100]) {
                // As each product is processed we create a new cProduct2 object and add it to the productList
                productList.add(new cProduct2(p));
            }
        }
        return productList;
    }


    public void processSelected() {

        //We create a new list of Products that we be populated only with Products if they are selected
        List<Product2> 
        selectedProducts = new List<Product2>();

        //We will cycle through our list of cProducts and will check to see if the selected property is set to true, if it is we add the Product to the selectedProducts list
        for(cProduct2 cProd: getProducts()) {
            if(cProd.selected == true) {
                selectedProducts.add(cProd.prod);
            }
        }

        // Now we have our list of selected products and can perform any type of logic we want, sending emails, updating a field on the Product, etc
        System.debug('These are the selected Products...');
        for(Product2 prod: selectedProducts) {
            system.debug(prod);
        }
        //productList=null; // we need this line if we performed a write operation  because getProducts gets a fresh list now
        //return null;
    }


    public List<cProduct2> getdealregProductsDetails()
    {
        //If there are records to be displayed then show the records else display message
        if((setCon.getResultSize()) > 0)
        {
            if(listOfProductWrapperlist[setCon.getPageNumber()-1].size() == 0) {
                productWrapperlist = new List<cProduct2>();
                for(Product2 p : (List<Product2>)setCon.getRecords()) {
                    productWrapperlist.add(new cProduct2(p));
                }
                listOfProductWrapperlist[setCon.getPageNumber()-1] = productWrapperlist;
            }
            system.debug('productWrapperlist-----'+productWrapperlist);
            return listOfProductWrapperlist[setCon.getPageNumber()-1];
        }
        else
        {
            return null;
        }           
    }
    // 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 Contact and a Boolean value
    public class cProduct2 {
        public Product2 prod {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cProduct2 object we pass a Product that is set to the con property. We also set the selected value to false
        public cProduct2(Product2 p) {
            prod = p;
            selected = false;
        }
        
        public cProduct2(Product2 prd, boolean check) {
            prod = prd;
            selected = check;
        }
    }
    
    
    public void searchProduct() {
            system.debug('productName : '+productName);
            if(productName != null && productName != '') {
                setCon = new ApexPages.StandardSetController(Database.query('Select Id,Name,ProductCode,Description,Family from Product2 where Name like \'%'+productName+'%\' Order by Name limit 2000'));
                
            } else {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            listOfProductWrapperlist.clear();
            setCon.setPageSize(25);
            Integer reminder = math.mod(setCon.getResultSize(),setCon.getPageSize());
            Integer listToCreateSize = (reminder == 0?(setCon.getResultSize()/setCon.getPageSize()):(setCon.getResultSize()/setCon.getPageSize())+1);
            for(Integer i=0; i < listToCreateSize ; i++){
                listOfProductWrapperlist.add(new List<cProduct2>());
            }
            if(listOfProductWrapperlist== null || listOfProductWrapperlist.isEmpty()) {
                isListEmpty = true;
            }       
        }
            
    public List<Product2> getSelectedProd() {
        if(selectedProd.size()>0) {
            System.debug(' selectProd '+selectedProd);
            return selectedProd;
        }
        else
        return null;
    }
    
    public PageReference DisplayDetails() {
        selectedproductList = new List<cProduct2>();
        
        for(cProduct2 prd : productList) {
            if(prd.selected == true) {
                selectedproductList.add(prd);
            }
        }
        system.debug(selectedproductList);
        PageReference reRend = new PageReference('/apex/DealRegProducts');
        reRend.setRedirect(false);
        return reRend;
    }
    
    public List<cProduct2> getProdDetails() {
        productList = new List<cProduct2>();
        List<Product2> prods = [Select Id,Name,ProductCode,Description,Family from Product2 Order by Name];
        
        for(Product2 p : prods) {
            productList.add(new cProduct2(p, false));
        }
        return productList;
    }
    
    public List<cProduct2> getSelectProdDetails() {
        selectedproductList = new List<cProduct2>();
        
        for(cProduct2 c : getProdDetails()) {
            System.debug(' selectProdDetails ' + c);
            
            if(c.selected == true)
            selectedproductList.add(c);
        }
        return selectedproductList;
    }
}
I have a custom object Deal_Reg__c. The business flow for this object is that a user can go to this object's page and add a Product to this Deal Reg. I have created a junction object called Deal_Reg_Products__c that has a Deg Reg Lookup as well as a Product Lookup along with other custom fields. After you press the "Add" button on the Deal Reg Products Related List section of the Deal Reg page, i would like the first VF page to be displayed.

The first VF page should basically only be a selectable list of all the Products. After the user selects one or multiple records to add to the specific Deal Reg, they will press a button called "Add Product". Pressing that button should fire off the second VF page.

The second VF page should consist of the selected list of Products from the first VF page along with a Deal_Reg_Products__c custom field, "Amount", next to each record where the user can input the value. After a value has been entered for each Product, the user will press a "Confirm" button which will send us back to the Deal Reg page where in the Deal Reg Products Related List section the selected Products are now visible and tied to that Deal Reg.

1. How to I tie this to the specific Deal Reg that the user would like to add the Products to?
2. After selecting the Products, how do I bring those values over to the second VF page where i can then enter in an "Amount" for each?
3. How can I get the "Confirm" button to actually commit the Products to the Deal Reg?

Here is the code i currently have:

VF Page 1:

<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController" tabstyle="Deal_Reg__c" id="myPage" recordSetVar="dealregproducts">
    <apex:form id="myForm">
        <apex:pageBlock title="Find Products" id="mypageBlock">
            <table width="100%">
                <tr>
                    <td width="25%" align="right">
                        <apex:pageBlockSection columns="1">
                            <b>By Keyword </b><br/>
                            <apex:inputText value="{!inputText1}" html-placeholder="Product Name"/>
                            <apex:commandButton value="Search" action="{!searchProduct}"/>  
                        </apex:pageBlockSection>
                    </td>
                </tr>
            </table>
            <br/>
            <p/>
        </apex:pageBlock>
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Add Products" action="{!DisplayDetails}" rerender="table"/>
            </apex:pageBlockButtons>
            <!-- In our table we are displaying the cProduct records -->
            <apex:pageBlockTable value="{!products}" var="p" id="table">
                <apex:column >
                    <!-- This is our selected Boolean property in our wrapper class -->
                    <apex:inputCheckbox value="{!p.selected}"/>
                </apex:column>
                <!-- This is how we access the contact values within our cProduct container/wrapper -->
                <apex:column value="{!p.prod.Name}" />
                <apex:column value="{!p.prod.ProductCode}" />
                <apex:column value="{!p.prod.Description}" />
                <apex:column value="{!p.prod.Family}" />
            </apex:pageBlockTable>
            <apex:outputLabel >{!SelectedProd}</apex:outputLabel>
        </apex:pageBlock>
    </apex:form>
</apex:page>


VF Page 2:

<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController">
   <apex:form >
       <apex:pageBlock title="Deal Registration Products">
            <apex:pageBlockButtons >
                <apex:commandButton value="Confirm"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!SelectProdDetails}" var="p">
                <apex:column value="{!p.prod.Name}"/>
                <!-- <apex:column value="{!p.prod.Forecast_Amount__c}"/> -->
            </apex:pageBlockTable>
            <apex:outputPanel >
                <apex:outputLabel >{!SelectProdDetails}</apex:outputLabel>
            </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>   
</apex:page>


Controller (I apologize for the mess here since I've been trying many different things):

public with sharing class wrapperClassController {

    public wrapperClassController(ApexPages.StandardSetController controller) {

    }


    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
           
                    setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            system.debug('setConSize-----'+setCon.getResultSize());
            return setCon;
        }
        set;
    }
    
    public wrapperClassController(ApexPages.StandardController controller) {

    }

   
    public String inputText1 {get;set;}
    public String productName {get;set;}
    public Boolean isListEmpty {get;set;}
    public List<cProduct2> productWrapperlist = new List<cProduct2>();
    public List<List<cProduct2>> listOfProductWrapperlist = new List<List<cProduct2>>();
   
    //Our collection of the class/wrapper objects cProduct2
    public List<cProduct2> productList {get; set;}
    public List<cProduct2> selectedproductList {get; set;}
    public List<Product2> selectedProducts {get; set;}
    public List<Product2> selectedProd = new List<Product2>();

    //This method uses a simple SOQL query to return a List of Products
    public List<cProduct2> getProducts() {
        if(productList == null) {
            productList = new List<cProduct2>();
            for(Product2 p: [select Id, Name, ProductCode, Description, Family from Product2 limit 100]) {
                // As each product is processed we create a new cProduct2 object and add it to the productList
                productList.add(new cProduct2(p));
            }
        }
        return productList;
    }


    public void processSelected() {

        //We create a new list of Products that we be populated only with Products if they are selected
        //List<Product2>
        selectedProducts = new List<Product2>();

        //We will cycle through our list of cProducts and will check to see if the selected property is set to true, if it is we add the Product to the selectedProducts list
        for(cProduct2 cProd: getProducts()) {
            if(cProd.selected == true) {
                selectedProducts.add(cProd.prod);
            }
        }

        // Now we have our list of selected products and can perform any type of logic we want, sending emails, updating a field on the Product, etc
        //System.debug('These are the selected Products...');
       // for(Product2 prod: selectedProducts) {
       //     system.debug(prod);
       // }
       // productList=null; // we need this line if we performed a write operation  because getProducts gets a fresh list now
       // return null;
    }


    public List<cProduct2> getdealregProductsDetails()
    {
        //If there are records to be displayed then show the records else display message
        if((setCon.getResultSize()) > 0)
        {
            if(listOfProductWrapperlist[setCon.getPageNumber()-1].size() == 0) {
                productWrapperlist = new List<cProduct2>();
                for(Product2 p : (List<Product2>)setCon.getRecords()) {
                    productWrapperlist.add(new cProduct2(p));
                }
                listOfProductWrapperlist[setCon.getPageNumber()-1] = productWrapperlist;
            }
            system.debug('productWrapperlist-----'+productWrapperlist);
            return listOfProductWrapperlist[setCon.getPageNumber()-1];
        }
        else
        {
            return null;
        }          
    }
    // 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 Contact and a Boolean value
    public class cProduct2 {
        public Product2 prod {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cProduct2 object we pass a Product that is set to the con property. We also set the selected value to false
        public cProduct2(Product2 p) {
            prod = p;
            selected = false;
        }
       
        public cProduct2(Product2 prd, boolean check) {
            prod = prd;
            selected = check;
        }
    }
   
   
    public void searchProduct() {
            system.debug('productName : '+productName);
            if(productName != null && productName != '') {
                setCon = new ApexPages.StandardSetController(Database.query('Select Id,Name,ProductCode,Description,Family from Product2 where Name like \'%'+productName+'%\' Order by Name limit 2000'));
               
            } else {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            listOfProductWrapperlist.clear();
            setCon.setPageSize(25);
            Integer reminder = math.mod(setCon.getResultSize(),setCon.getPageSize());
            Integer listToCreateSize = (reminder == 0?(setCon.getResultSize()/setCon.getPageSize()):(setCon.getResultSize()/setCon.getPageSize())+1);
            for(Integer i=0; i < listToCreateSize ; i++){
                listOfProductWrapperlist.add(new List<cProduct2>());
            }
            if(listOfProductWrapperlist== null || listOfProductWrapperlist.isEmpty()) {
                isListEmpty = true;
            }      
        }
       
    public PageReference getForecastAmount() {
        Page.DealRegProducts.getParameters().put('products_selected', 'selectedProducts');
        //processSelected();
        return Page.DealRegProducts;
    }
   
    //public PageReference secondTry() {
    //    PageReference page = Page.DealRegProducts;
    //    page.getParameters().put(Id, selectedProducts.Id);
    //    return page;
    //}
   
    public List<Product2> getSelectedProd() {
        if(selectedProd.size()>0) {
            System.debug(' selectProd '+selectedProd);
            return selectedProd;
        }
        else
        return null;
    }
   
    public PageReference DisplayDetails() {
        selectedproductList = new List<cProduct2>();
       
        for(cProduct2 prd : productList) {
            if(prd.selected == true) {
                selectedproductList.add(prd);
            }
        }
       
        PageReference reRend = new PageReference('/apex/DealRegProducts');
        reRend.setRedirect(false);
        return reRend;
    }
   
    public List<cProduct2> getProdDetails() {
        productList = new List<cProduct2>();
        List<Product2> prods = [Select Id,Name,ProductCode,Description,Family from Product2 Order by Name];
       
        for(Product2 p : prods) {
            productList.add(new cProduct2(p, false));
        }
        return productList;
    }
   
    public List<cProduct2> getSelectProdDetails() {
        selectedproductList = new List<cProduct2>();
       
        for(cProduct2 c : getProdDetails()) {
            System.debug(' selectProdDetails ' + c);
           
            if(c.selected == true)
            selectedproductList.add(c);
        }
        return selectedproductList;
    }
}
Most of my scenario is complete but am having difficulities with a few areas (bottom of post).

I have a custom object Deal_Reg__c. The business flow for this object is that a user can go to this object's page and add a Product to this Deal Reg (related list of DealRegistrationProducts). I have created a junction object called Deal_Reg_Products__c that has a Deg Reg Lookup as well as a Product Lookup along with other custom fields. After you press the "Add" button on the Deal Reg Products Related List section of the Deal Reg page, i would like the first VF page to be displayed.

The first VF page should basically only be a selectable list of all the Products with the name of the Deal_Reg__c that we were coming from. After the user selects one or multiple records to add to the specific Deal Reg, they will press a button called "Add Product". Pressing that button should fire off the second VF page.

The second VF page should consist of the selected list of Products from the first VF page along with a Deal_Reg_Products__c.Forecast_Amount__c custom field, "Forecast Amount", next to each record where the user can input the value. After a value has been entered for each Product, the user will press a "Confirm" button which will send us back to the Deal Reg page where in the Deal Reg Products Related List section the selected Products are now visible with the Forecast Amount we entered and are now tied to that Deal Reg.

1. I would like to have a cancel button on both the visualforce pages. How can i get back to the original deal_reg__c?
public id dealregId;

public pageReference cancel(){
        return new PageReference('/'+dealregId);
    }
I though that this would work, but i get directed to a page with the error: URL No Longer Exists
The URL has now changed to: https://cs10.salesforce.com/null
 
Most of my scenario is complete but am having difficulities with a few areas (bottom of post).

I have a custom object Deal_Reg__c. The business flow for this object is that a user can go to this object's page and add a Product to this Deal Reg (related list of DealRegistrationProducts). I have created a junction object called Deal_Reg_Products__c that has a Deg Reg Lookup as well as a Product Lookup along with other custom fields. After you press the "Add" button on the Deal Reg Products Related List section of the Deal Reg page, i would like the first VF page to be displayed.

The first VF page should basically only be a selectable list of all the Products with the name of the Deal_Reg__c that we were coming from. After the user selects one or multiple records to add to the specific Deal Reg, they will press a button called "Add Product". Pressing that button should fire off the second VF page.

The second VF page should consist of the selected list of Products from the first VF page along with a Deal_Reg_Products__c.Forecast_Amount__c custom field, "Forecast Amount", next to each record where the user can input the value. After a value has been entered for each Product, the user will press a "Confirm" button which will send us back to the Deal Reg page where in the Deal Reg Products Related List section the selected Products are now visible with the Forecast Amount we entered and are now tied to that Deal Reg.

Here is my code for VF1:
<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController" tabstyle="Deal_Reg__c" id="myPage" recordSetVar="Deal_Registration_Products__r">
    <apex:form id="myForm">
       <!-- <apex:pageBlock title="Edit Account for {!$Deal_Reg__c.id}">
        </apex:pageBlock> -->
        <br/>
        <br/>
        <apex:pageBlock title="Find Products" id="mypageBlock">
            <table width="100%">
                <tr>
                    <td width="25%" align="right">
                        <apex:pageBlockSection columns="1">
                            <b>By Keyword </b><br/>
                            <apex:inputText value="{!inputText1}" html-placeholder="Product Name"/>
                            <apex:commandButton value="Search" action="{!searchProduct}"/>   
                        </apex:pageBlockSection>
                    </td>
                </tr>
            </table>
            <br/>
            <p/>
        </apex:pageBlock>
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Add Products" action="{!DisplayDetails}"/>
            </apex:pageBlockButtons>
            <!-- In our table we are displaying the cProduct records -->
            <apex:pageBlockTable value="{!products}" var="p" id="table">
                <apex:column >
                    <!-- This is our selected Boolean property in our wrapper class -->
                    <apex:inputCheckbox value="{!p.selected}"/>
                </apex:column>
                <!-- This is how we access the contact values within our cProduct container/wrapper -->
                <apex:column value="{!p.prod.Name}" />
                <apex:column value="{!p.prod.ProductCode}" />
                <apex:column value="{!p.prod.Description}" />
                <apex:column value="{!p.prod.Family}" />
            </apex:pageBlockTable>
            <apex:outputLabel >{!SelectedProd}</apex:outputLabel>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Here is my code for VF2:
<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController" recordSetVar="products">
   <apex:form >
       <apex:pageBlock title="Deal Registration Products">
            <apex:pageBlockButtons >
                <apex:commandButton value="Confirm"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!selectedproductList}" var="p">
                <apex:column value="{!p.prod.Name}" headerValue="Product"/>
                <apex:column headerValue="Forecast Amount">
                    <apex:inputText value="{!p.forecastAmount}" />
                </apex:column> 
                <!-- <apex:column headerValue="Forecast Amount2">
                    <apex:inputText value="{!p.prod.Deal_Registration_Products__r}" />
                </apex:column>  -->
            </apex:pageBlockTable> 
            <apex:outputPanel >
                <apex:outputLabel >{!selectedproductList}</apex:outputLabel> 
            </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>  
</apex:page>

And here is my controller:
public with sharing class wrapperClassController {

    public wrapperClassController(ApexPages.StandardSetController controller) {

    }


    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
            
                    setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            system.debug('setConSize-----'+setCon.getResultSize());
            return setCon;
        }
        set;
    }
    
    public String inputText1 {get;set;}
    public String productName {get;set;}
    public Boolean isListEmpty {get;set;}
    public List<cProduct2> productWrapperlist = new List<cProduct2>();
    public List<List<cProduct2>> listOfProductWrapperlist = new List<List<cProduct2>>();
    public Deal_Registration_Products__c dealRegProds;
    
    //Our collection of the class/wrapper objects cProduct2 
    public List<cProduct2> productList {get; set;}
    public List<cProduct2> selectedproductList {get; set;}
    public List<Product2> selectedProducts {get; set;}
    public List<Product2> selectedProd = new List<Product2>();

    //This method uses a simple SOQL query to return a List of Products
    public List<cProduct2> getProducts() {
        if(productList == null) {
            productList = new List<cProduct2>();
            for(Product2 p: [select Id, Name, ProductCode, Description, Family from Product2 limit 100]) {
                // As each product is processed we create a new cProduct2 object and add it to the productList
                productList.add(new cProduct2(p));
            }
        }
        return productList;
    }


    public void processSelected() {

        //We create a new list of Products that we be populated only with Products if they are selected
        List<Product2> 
        selectedProducts = new List<Product2>();

        //We will cycle through our list of cProducts and will check to see if the selected property is set to true, if it is we add the Product to the selectedProducts list
        for(cProduct2 cProd: getProducts()) {
            if(cProd.selected == true) {
                selectedProducts.add(cProd.prod);
            }
        }

        // Now we have our list of selected products and can perform any type of logic we want, sending emails, updating a field on the Product, etc
        System.debug('These are the selected Products...');
        for(Product2 prod: selectedProducts) {
            system.debug(prod);
        }
        //productList=null; // we need this line if we performed a write operation  because getProducts gets a fresh list now
        //return null;
    }


    public List<cProduct2> getdealregProductsDetails()
    {
        //If there are records to be displayed then show the records else display message
        if((setCon.getResultSize()) > 0)
        {
            if(listOfProductWrapperlist[setCon.getPageNumber()-1].size() == 0) {
                productWrapperlist = new List<cProduct2>();
                for(Product2 p : (List<Product2>)setCon.getRecords()) {
                    productWrapperlist.add(new cProduct2(p));
                }
                listOfProductWrapperlist[setCon.getPageNumber()-1] = productWrapperlist;
            }
            system.debug('productWrapperlist-----'+productWrapperlist);
            return listOfProductWrapperlist[setCon.getPageNumber()-1];
        }
        else
        {
            return null;
        }           
    }
    // 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 Contact and a Boolean value
    public class cProduct2 {
        public Product2 prod {get; set;}
        public Boolean selected {get; set;}
        public String forecastAmount {get; set;}

        //This is the contructor method. When we create a new cProduct2 object we pass a Product that is set to the con property. We also set the selected value to false
        public cProduct2(Product2 p) {
            prod = p;
            selected = false;
        }
        
        public cProduct2(Product2 prd, boolean check) {
            prod = prd;
            selected = check;
        }
    }
    
    public class cDealRegProd {
        public Deal_Registration_Products__c dealRegProd {get; set;}
    }
        
    
    
    public void searchProduct() {
            system.debug('productName : '+productName);
            if(productName != null && productName != '') {
                setCon = new ApexPages.StandardSetController(Database.query('Select Id,Name,ProductCode,Description,Family from Product2 where Name like \'%'+productName+'%\' Order by Name limit 2000'));
                
            } else {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            listOfProductWrapperlist.clear();
            setCon.setPageSize(25);
            Integer reminder = math.mod(setCon.getResultSize(),setCon.getPageSize());
            Integer listToCreateSize = (reminder == 0?(setCon.getResultSize()/setCon.getPageSize()):(setCon.getResultSize()/setCon.getPageSize())+1);
            for(Integer i=0; i < listToCreateSize ; i++){
                listOfProductWrapperlist.add(new List<cProduct2>());
            }
            if(listOfProductWrapperlist== null || listOfProductWrapperlist.isEmpty()) {
                isListEmpty = true;
            }       
        }
            
    public List<Product2> getSelectedProd() {
        if(selectedProd.size()>0) {
            System.debug(' selectProd '+selectedProd);
            return selectedProd;
        }
        else
        return null;
    }
    
    public PageReference DisplayDetails() {
        selectedproductList = new List<cProduct2>();
        
        for(cProduct2 prd : productList) {
            if(prd.selected == true) {
                selectedproductList.add(prd);
            }
        }
        system.debug(selectedproductList);
        PageReference reRend = new PageReference('/apex/DealRegProducts');
        reRend.setRedirect(false);
        return reRend;
    }
    
    public List<cProduct2> getProdDetails() {
        productList = new List<cProduct2>();
        List<Product2> prods = [Select Id,Name,ProductCode,Description,Family from Product2 Order by Name];
        
        for(Product2 p : prods) {
            productList.add(new cProduct2(p, false));
        }
        return productList;
    }
    
    public List<cProduct2> getSelectProdDetails() {
        selectedproductList = new List<cProduct2>();
        
        for(cProduct2 c : getProdDetails()) {
            System.debug(' selectProdDetails ' + c);
            
            if(c.selected == true)
            selectedproductList.add(c);
        }
        return selectedproductList;
    }
}


How do i display the name of the Deal_Reg__c on the 1st VF page?
How do i tie the selected Products and entered Forecast Amount to the corresponding Deal Reg after pressing "Confirm" and have those values displayed in the Related List section of the Deal_Reg__c page?

Thanks,
I need to write a trigger on the OpportunityLineItem. Part of the funtionality will involve me getting to the User object. Can someone help me if figuring out how to map these objects?

Here is what it would look like in SQL:

SELECT UserID, Name, Business__c
FROM AccountTeamMember atm
INNER JOIN Account a ON a.ID = atm.AccountID
INNER JOIN Opportunity o ON o.AccountID = a.ID
INNER JOIN OpportunityLineItem oli ON oli.OpportunityID = o.ID
I have two VF pages. The first page is a list of Products. The user will select one or many Products and press a custom button. This will bring the user to the second VF page. This page displays a list of the Products they had previously selected. I would like to have an input field next to each Product where they can enter in the Forecast Amount (custom field on custom object). When i try doing that, i get the following error:

Error: Could not resolve the entity from <apex:inputField> value binding '{!p.Forecast_Amount__c}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.

Any idea how i can resolve this issue?

VF Page 2:

<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController" recordSetVar="products">
   <apex:form >
       <apex:pageBlock title="Deal Registration Products">
            <apex:pageBlockButtons >
                <apex:commandButton value="Confirm"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!selectedproductList}" var="p">
                <apex:column value="{!p.prod.Name}"/>
                <!-- <apex:column value="{!p.prod.Forecast_Amount__c}"/> -->
                <apex:column headerValue="Forecast Amount">
                    <apex:inputField value="{!p.Forecast_Amount__c}"/>
                </apex:column>
            </apex:pageBlockTable> 
            <apex:outputPanel >
                <apex:outputLabel >{!selectedproductList}</apex:outputLabel> 
            </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>  
</apex:page>


Contorller:

public with sharing class wrapperClassController {

    public wrapperClassController(ApexPages.StandardSetController controller) {

    }


    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
            
                    setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            system.debug('setConSize-----'+setCon.getResultSize());
            return setCon;
        }
        set;
    }
    
    public String inputText1 {get;set;}
    public String productName {get;set;}
    public Boolean isListEmpty {get;set;}
    public List<cProduct2> productWrapperlist = new List<cProduct2>();
    public List<List<cProduct2>> listOfProductWrapperlist = new List<List<cProduct2>>();
    public Deal_Registration_Products__c dealRegProds;
    
    //Our collection of the class/wrapper objects cProduct2 
    public List<cProduct2> productList {get; set;}
    public List<cProduct2> selectedproductList {get; set;}
    public List<Product2> selectedProducts {get; set;}
    public List<Product2> selectedProd = new List<Product2>();

    //This method uses a simple SOQL query to return a List of Products
    public List<cProduct2> getProducts() {
        if(productList == null) {
            productList = new List<cProduct2>();
            for(Product2 p: [select Id, Name, ProductCode, Description, Family from Product2 limit 100]) {
                // As each product is processed we create a new cProduct2 object and add it to the productList
                productList.add(new cProduct2(p));
            }
        }
        return productList;
    }


    public void processSelected() {

        //We create a new list of Products that we be populated only with Products if they are selected
        List<Product2> 
        selectedProducts = new List<Product2>();

        //We will cycle through our list of cProducts and will check to see if the selected property is set to true, if it is we add the Product to the selectedProducts list
        for(cProduct2 cProd: getProducts()) {
            if(cProd.selected == true) {
                selectedProducts.add(cProd.prod);
            }
        }

        // Now we have our list of selected products and can perform any type of logic we want, sending emails, updating a field on the Product, etc
        System.debug('These are the selected Products...');
        for(Product2 prod: selectedProducts) {
            system.debug(prod);
        }
        //productList=null; // we need this line if we performed a write operation  because getProducts gets a fresh list now
        //return null;
    }


    public List<cProduct2> getdealregProductsDetails()
    {
        //If there are records to be displayed then show the records else display message
        if((setCon.getResultSize()) > 0)
        {
            if(listOfProductWrapperlist[setCon.getPageNumber()-1].size() == 0) {
                productWrapperlist = new List<cProduct2>();
                for(Product2 p : (List<Product2>)setCon.getRecords()) {
                    productWrapperlist.add(new cProduct2(p));
                }
                listOfProductWrapperlist[setCon.getPageNumber()-1] = productWrapperlist;
            }
            system.debug('productWrapperlist-----'+productWrapperlist);
            return listOfProductWrapperlist[setCon.getPageNumber()-1];
        }
        else
        {
            return null;
        }           
    }
    // 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 Contact and a Boolean value
    public class cProduct2 {
        public Product2 prod {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cProduct2 object we pass a Product that is set to the con property. We also set the selected value to false
        public cProduct2(Product2 p) {
            prod = p;
            selected = false;
        }
        
        public cProduct2(Product2 prd, boolean check) {
            prod = prd;
            selected = check;
        }
    }
    
    
    public void searchProduct() {
            system.debug('productName : '+productName);
            if(productName != null && productName != '') {
                setCon = new ApexPages.StandardSetController(Database.query('Select Id,Name,ProductCode,Description,Family from Product2 where Name like \'%'+productName+'%\' Order by Name limit 2000'));
                
            } else {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            listOfProductWrapperlist.clear();
            setCon.setPageSize(25);
            Integer reminder = math.mod(setCon.getResultSize(),setCon.getPageSize());
            Integer listToCreateSize = (reminder == 0?(setCon.getResultSize()/setCon.getPageSize()):(setCon.getResultSize()/setCon.getPageSize())+1);
            for(Integer i=0; i < listToCreateSize ; i++){
                listOfProductWrapperlist.add(new List<cProduct2>());
            }
            if(listOfProductWrapperlist== null || listOfProductWrapperlist.isEmpty()) {
                isListEmpty = true;
            }       
        }
            
    public List<Product2> getSelectedProd() {
        if(selectedProd.size()>0) {
            System.debug(' selectProd '+selectedProd);
            return selectedProd;
        }
        else
        return null;
    }
    
    public PageReference DisplayDetails() {
        selectedproductList = new List<cProduct2>();
        
        for(cProduct2 prd : productList) {
            if(prd.selected == true) {
                selectedproductList.add(prd);
            }
        }
        system.debug(selectedproductList);
        PageReference reRend = new PageReference('/apex/DealRegProducts');
        reRend.setRedirect(false);
        return reRend;
    }
    
    public List<cProduct2> getProdDetails() {
        productList = new List<cProduct2>();
        List<Product2> prods = [Select Id,Name,ProductCode,Description,Family from Product2 Order by Name];
        
        for(Product2 p : prods) {
            productList.add(new cProduct2(p, false));
        }
        return productList;
    }
    
    public List<cProduct2> getSelectProdDetails() {
        selectedproductList = new List<cProduct2>();
        
        for(cProduct2 c : getProdDetails()) {
            System.debug(' selectProdDetails ' + c);
            
            if(c.selected == true)
            selectedproductList.add(c);
        }
        return selectedproductList;
    }
}
I have a custom object Deal_Reg__c. The business flow for this object is that a user can go to this object's page and add a Product to this Deal Reg. I have created a junction object called Deal_Reg_Products__c that has a Deg Reg Lookup as well as a Product Lookup along with other custom fields. After you press the "Add" button on the Deal Reg Products Related List section of the Deal Reg page, i would like the first VF page to be displayed.

The first VF page should basically only be a selectable list of all the Products. After the user selects one or multiple records to add to the specific Deal Reg, they will press a button called "Add Product". Pressing that button should fire off the second VF page.

The second VF page should consist of the selected list of Products from the first VF page along with a Deal_Reg_Products__c custom field, "Amount", next to each record where the user can input the value. After a value has been entered for each Product, the user will press a "Confirm" button which will send us back to the Deal Reg page where in the Deal Reg Products Related List section the selected Products are now visible and tied to that Deal Reg.

1. How to I tie this to the specific Deal Reg that the user would like to add the Products to?
2. After selecting the Products, how do I bring those values over to the second VF page where i can then enter in an "Amount" for each?
3. How can I get the "Confirm" button to actually commit the Products to the Deal Reg?

Here is the code i currently have:

VF Page 1:

<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController" tabstyle="Deal_Reg__c" id="myPage" recordSetVar="dealregproducts">
    <apex:form id="myForm">
        <apex:pageBlock title="Find Products" id="mypageBlock">
            <table width="100%">
                <tr>
                    <td width="25%" align="right">
                        <apex:pageBlockSection columns="1">
                            <b>By Keyword </b><br/>
                            <apex:inputText value="{!inputText1}" html-placeholder="Product Name"/>
                            <apex:commandButton value="Search" action="{!searchProduct}"/>  
                        </apex:pageBlockSection>
                    </td>
                </tr>
            </table>
            <br/>
            <p/>
        </apex:pageBlock>
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Add Products" action="{!DisplayDetails}" rerender="table"/>
            </apex:pageBlockButtons>
            <!-- In our table we are displaying the cProduct records -->
            <apex:pageBlockTable value="{!products}" var="p" id="table">
                <apex:column >
                    <!-- This is our selected Boolean property in our wrapper class -->
                    <apex:inputCheckbox value="{!p.selected}"/>
                </apex:column>
                <!-- This is how we access the contact values within our cProduct container/wrapper -->
                <apex:column value="{!p.prod.Name}" />
                <apex:column value="{!p.prod.ProductCode}" />
                <apex:column value="{!p.prod.Description}" />
                <apex:column value="{!p.prod.Family}" />
            </apex:pageBlockTable>
            <apex:outputLabel >{!SelectedProd}</apex:outputLabel>
        </apex:pageBlock>
    </apex:form>
</apex:page>


VF Page 2:

<apex:page standardController="Deal_Registration_Products__c" extensions="wrapperClassController">
   <apex:form >
       <apex:pageBlock title="Deal Registration Products">
            <apex:pageBlockButtons >
                <apex:commandButton value="Confirm"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!SelectProdDetails}" var="p">
                <apex:column value="{!p.prod.Name}"/>
                <!-- <apex:column value="{!p.prod.Forecast_Amount__c}"/> -->
            </apex:pageBlockTable>
            <apex:outputPanel >
                <apex:outputLabel >{!SelectProdDetails}</apex:outputLabel>
            </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>   
</apex:page>


Controller (I apologize for the mess here since I've been trying many different things):

public with sharing class wrapperClassController {

    public wrapperClassController(ApexPages.StandardSetController controller) {

    }


    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
           
                    setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            system.debug('setConSize-----'+setCon.getResultSize());
            return setCon;
        }
        set;
    }
    
    public wrapperClassController(ApexPages.StandardController controller) {

    }

   
    public String inputText1 {get;set;}
    public String productName {get;set;}
    public Boolean isListEmpty {get;set;}
    public List<cProduct2> productWrapperlist = new List<cProduct2>();
    public List<List<cProduct2>> listOfProductWrapperlist = new List<List<cProduct2>>();
   
    //Our collection of the class/wrapper objects cProduct2
    public List<cProduct2> productList {get; set;}
    public List<cProduct2> selectedproductList {get; set;}
    public List<Product2> selectedProducts {get; set;}
    public List<Product2> selectedProd = new List<Product2>();

    //This method uses a simple SOQL query to return a List of Products
    public List<cProduct2> getProducts() {
        if(productList == null) {
            productList = new List<cProduct2>();
            for(Product2 p: [select Id, Name, ProductCode, Description, Family from Product2 limit 100]) {
                // As each product is processed we create a new cProduct2 object and add it to the productList
                productList.add(new cProduct2(p));
            }
        }
        return productList;
    }


    public void processSelected() {

        //We create a new list of Products that we be populated only with Products if they are selected
        //List<Product2>
        selectedProducts = new List<Product2>();

        //We will cycle through our list of cProducts and will check to see if the selected property is set to true, if it is we add the Product to the selectedProducts list
        for(cProduct2 cProd: getProducts()) {
            if(cProd.selected == true) {
                selectedProducts.add(cProd.prod);
            }
        }

        // Now we have our list of selected products and can perform any type of logic we want, sending emails, updating a field on the Product, etc
        //System.debug('These are the selected Products...');
       // for(Product2 prod: selectedProducts) {
       //     system.debug(prod);
       // }
       // productList=null; // we need this line if we performed a write operation  because getProducts gets a fresh list now
       // return null;
    }


    public List<cProduct2> getdealregProductsDetails()
    {
        //If there are records to be displayed then show the records else display message
        if((setCon.getResultSize()) > 0)
        {
            if(listOfProductWrapperlist[setCon.getPageNumber()-1].size() == 0) {
                productWrapperlist = new List<cProduct2>();
                for(Product2 p : (List<Product2>)setCon.getRecords()) {
                    productWrapperlist.add(new cProduct2(p));
                }
                listOfProductWrapperlist[setCon.getPageNumber()-1] = productWrapperlist;
            }
            system.debug('productWrapperlist-----'+productWrapperlist);
            return listOfProductWrapperlist[setCon.getPageNumber()-1];
        }
        else
        {
            return null;
        }          
    }
    // 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 Contact and a Boolean value
    public class cProduct2 {
        public Product2 prod {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cProduct2 object we pass a Product that is set to the con property. We also set the selected value to false
        public cProduct2(Product2 p) {
            prod = p;
            selected = false;
        }
       
        public cProduct2(Product2 prd, boolean check) {
            prod = prd;
            selected = check;
        }
    }
   
   
    public void searchProduct() {
            system.debug('productName : '+productName);
            if(productName != null && productName != '') {
                setCon = new ApexPages.StandardSetController(Database.query('Select Id,Name,ProductCode,Description,Family from Product2 where Name like \'%'+productName+'%\' Order by Name limit 2000'));
               
            } else {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator([Select Id,Name,ProductCode,Description,Family from Product2 Order by Name]));
            }
            listOfProductWrapperlist.clear();
            setCon.setPageSize(25);
            Integer reminder = math.mod(setCon.getResultSize(),setCon.getPageSize());
            Integer listToCreateSize = (reminder == 0?(setCon.getResultSize()/setCon.getPageSize()):(setCon.getResultSize()/setCon.getPageSize())+1);
            for(Integer i=0; i < listToCreateSize ; i++){
                listOfProductWrapperlist.add(new List<cProduct2>());
            }
            if(listOfProductWrapperlist== null || listOfProductWrapperlist.isEmpty()) {
                isListEmpty = true;
            }      
        }
       
    public PageReference getForecastAmount() {
        Page.DealRegProducts.getParameters().put('products_selected', 'selectedProducts');
        //processSelected();
        return Page.DealRegProducts;
    }
   
    //public PageReference secondTry() {
    //    PageReference page = Page.DealRegProducts;
    //    page.getParameters().put(Id, selectedProducts.Id);
    //    return page;
    //}
   
    public List<Product2> getSelectedProd() {
        if(selectedProd.size()>0) {
            System.debug(' selectProd '+selectedProd);
            return selectedProd;
        }
        else
        return null;
    }
   
    public PageReference DisplayDetails() {
        selectedproductList = new List<cProduct2>();
       
        for(cProduct2 prd : productList) {
            if(prd.selected == true) {
                selectedproductList.add(prd);
            }
        }
       
        PageReference reRend = new PageReference('/apex/DealRegProducts');
        reRend.setRedirect(false);
        return reRend;
    }
   
    public List<cProduct2> getProdDetails() {
        productList = new List<cProduct2>();
        List<Product2> prods = [Select Id,Name,ProductCode,Description,Family from Product2 Order by Name];
       
        for(Product2 p : prods) {
            productList.add(new cProduct2(p, false));
        }
        return productList;
    }
   
    public List<cProduct2> getSelectProdDetails() {
        selectedproductList = new List<cProduct2>();
       
        for(cProduct2 c : getProdDetails()) {
            System.debug(' selectProdDetails ' + c);
           
            if(c.selected == true)
            selectedproductList.add(c);
        }
        return selectedproductList;
    }
}