function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SaktiSakti 

Passing parameters in the pop up without generating the record id from another VF page.

Hi,

I am new to salesforce customization. I am devloping a page, where I need a pop up after clicking on preview button. In my 1st page I have two fields. After filling up the field values, I am clicking on preview button. Now Ia ma able tp open pop up. But not able to pass parameters in the pop up. Here during clicking the button, i am not storing the field values. 

Can anyone help me out how to pass parameter in the pop up without generating the record id.

Many Thanks in Advance.
Ankit Gupta@ DeveloperAnkit Gupta@ Developer
Hi Sakti,

You can use the same controller in popup and try to display the fields..


 
SaktiSakti
Thanks Ankit for your reply.

I am providing more details of my VF page and Apex Class. 

My 1st VF Page : PopUpFormPage and the class is PopUpFormClass


User-added image


Code for PopUpFormPage
********************************


<apex:page standardController="Incident__c" extensions="PopUpFormClass" sidebar="false" showHeader="false">
   <apex:form >
    
    <script type="text/javascript">
    
    function OpenPreviewPopUp()
    {
        var w = window.open('/apex/GetParamFormPage?Short_Desc=',"MsgWindow", target='_blank')
        return w;      
    }  
    </script>
    
    <apex:pageBlock title="Passing Parameters Form Aplet">
        
          <apex:pageBlockButtons location="bottom">
               <apex:commandButton value="Pass Parameters" action="{!PassParamNow}" onclick="OpenPreviewPopUp();return false;"/>
          </apex:pageBlockButtons>
   
        <apex:pageBlockSection columns="2" title="Incident Details">
            <apex:inputField value="{!i.Short_Description__c}"/>
            <apex:inputField value="{!i.Detailed_Description__c}" />
        </apex:pageBlockSection>
        
    </apex:pageBlock>
    </apex:form>
</apex:page>

Code for PopUpFormClass
********************************


public class PopUpFormClass {

    Public String Short_Desc{get;set;}
    Public String Detailed_Desc{get;set;}

    Public Incident__c i {get; set;}
    
    private ApexPages.StandardController standard_Controller;
    public PopUpFormClass(ApexPages.StandardController standard_Controller) 
    {
        i = new Incident__c();
    }
     
    Public PageReference PassParamNow(){
   
     PageReference Px = Page.GetParamFormPage;
       
       Px.getParameters().put('Short_Desc', i.Short_Description__c);
       Px.getParameters().put('Detailed_Desc', i.Detailed_Description__c);
        
        
        Px.setRedirect(true);
        return Px;
        
    }
    
}

Now After filling these two fields, I am clicking on Pass Parameter button.

User-added image

Here I am getting the pop up as well. but not able to pass the string values or parameters in the pop up vf page. So it is coming as blank.
Below are the codes that I am using for VF page anc the class.


My 2nd VF page(Popup Page) : GetParamFormPage nad the class is ​GetParmForm
**********************************************************************************************************
Code for VF Page: GetParamFormPage 
*************************************************

<apex:page standardController="Incident__c" extensions="GetParmForm" sidebar="false" showHeader="false">
  
<apex:form >
  
    <apex:pageBlock title="Please Review and Submit or Close to Update" mode="edit">
          <apex:pageBlockButtons location="bottom">

            <apex:commandButton value="Submit" action="{!SaveRecord}"/>
        </apex:pageBlockButtons>
        
        
        <apex:pageBlockSection columns="2" title="Incident Details" showHeader="true" rendered="true" >
            
            <apex:outputText value="Short Description:  {!Short_Desc_Preview}"> </apex:outputText>
            <apex:outputText value="Detailed Description:  {!Delail_Desc_Preview}"> </apex:outputText>

        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>    
</apex:page>


Code for ​Class : GetParmForm
***************************************


public class GetParmForm {
    
    Public Incident__c param {get; set;}
    Public String Short_Desc_Preview {get;set;}
    Public String Delail_Desc_Preview {get;set;}
    
    Public String varShortDesc {get;set;}

    private ApexPages.StandardController standard_Controller;
    public GetParmForm(ApexPages.StandardController standard_Controller){
        param = new Incident__c();
      
        
        Short_Desc_Preview =   ApexPages.currentPage().getParameters().get('Short_Desc');        
        Delail_Desc_Preview =   ApexPages.currentPage().getParameters().get('Detailed_Desc');
        
       }
        
    //Follwoing will save the record, on clicking Submit button in Preview Page
     
    public PageReference SaveRecord()
    {
        insert param;
         PageReference newPage = new PageReference('/apex/IncidentListView');
       
        newPage.setRedirect(true);
        return newPage;
    }
      
   
}



Thanks,
SAKTI