You need to sign in to do that
Don't have an account?
basha sk
How to redirect to the previous visualforce page from current visualforce page (like back button)?
How to redirect previous visualforce page from current visualforce page?
Hi Everyone,
First of all here i'm having two visualforce pages
1.Webinar_Details Page
2.MappingLeadPage
webinar_details page is a record details page it displays all the details of one particular record.
In this page i'm having a button calles "Mapping Lead" by clicking the button it redirects to the
"MappingLeadPage" visualforce page.after mapping the fields i'm saving the mapping and redirects to the previous record
details page.
here for redirecting i need the previous record id.how can i get the previous record id for redirecting
Webinar_Details Page
--------------------
<apex:page standardController="Webinar__c" tabstyle="Adobe_Webinars__tab" sidebar="false" extensions="RedirectPage">
<apex:form >
<apex:pageBlock title="Adobe Connect Integration with Salesforce">
<center>
<apex:commandButton value="Register" action="{!doRegistrationForm}"/>
</center><br/><br/>
<apex:pageBlockSection title="{!Webinar__c.Name} Details">
<apex:outputField value="{!Webinar__c.Name}"/>
<apex:inlineEditSupport event="ondblClick" /><br/>
</apex:pageBlockSection><br/>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockTable value="{!wrapperAccountList}" var="w" id="table" title="All Accounts">
<apex:column value="{!w.acc.Login__c}"></apex:column>
<apex:inlineEditSupport event="ondblClick" />
<apex:column value="{!w.acc.isLead__c}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<center>
<apex:commandButton id="leadcreate1" value="Lead Mapping" action="{!doMappingPage}"/>
</center><br/>
</apex:pageBlock>
</apex:form>
</apex:page>
extension:
-----------
public class RedirectPage{
public PageReference doMappingPage(){
PageReference parentPage = new PageReference('/apex/MappingLeadPage');
parentPage.setRedirect(true);
return parentPage;
}
}
MappingLeadPage
----------------
<apex:page standardController="Lead" extensions="MappingLead1">
<apex:form >
<apex:pageBlock title="Lead Mapping" >
<apex:pageBlockSection >
<apex:pageBlock >
<apex:pageBlockSection >
Webinar Attendee Name <apex:inputField value="{!Lead.LeadFields__c}"/><br/>
Webinar Attendee Email <apex:inputField value="{!Lead.Lead_Fields1__c}"/><br/>
Webinar Attendee Company <apex:inputField value="{!Lead.Lead_Fields2__c}"/><br/>
Webinar Attende Mobile Number <apex:inputField value="{!Lead.Lead_Fields7__c}"/><br/><br/>
<!-- <apex:outputLink value="{!URLFOR($Page.Webinar_Details,w.acc.Id,[id=w.acc.Id])}">{!w.acc.name}</apex:outputLink> -->
</apex:pageBlockSection>
<apex:commandButton id="saveBtn" value="Save Mapping" action="{!processButtonClick}" style="margin-left:-2%"/>
<apex:commandButton id="saveBtn1" value="Previous Page" action="{!goBack}" style="margin-left:30%"/>
<apex:pageBlockButtons >
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
extension
------------
public with sharing class MappingLead1 {
public Lead login;
private final ApexPages.StandardController controller;
public MappingLead1(ApexPages.StandardController controller){
this.login= (Lead)controller.getRecord();
}
public PageReference goBack(){
PageReference pg = new PageReference('/apex/Webinar_Details');
pg.setRedirect(true);
return pg;
}
}
from the MappingLeadPage page by clicking the "Previous Page" button how i redirected to the Webinar_Details Page vf page.
Please anybody help i'm trying this logic from yesterday
Thanks In Advance
Hi Everyone,
First of all here i'm having two visualforce pages
1.Webinar_Details Page
2.MappingLeadPage
webinar_details page is a record details page it displays all the details of one particular record.
In this page i'm having a button calles "Mapping Lead" by clicking the button it redirects to the
"MappingLeadPage" visualforce page.after mapping the fields i'm saving the mapping and redirects to the previous record
details page.
here for redirecting i need the previous record id.how can i get the previous record id for redirecting
Webinar_Details Page
--------------------
<apex:page standardController="Webinar__c" tabstyle="Adobe_Webinars__tab" sidebar="false" extensions="RedirectPage">
<apex:form >
<apex:pageBlock title="Adobe Connect Integration with Salesforce">
<center>
<apex:commandButton value="Register" action="{!doRegistrationForm}"/>
</center><br/><br/>
<apex:pageBlockSection title="{!Webinar__c.Name} Details">
<apex:outputField value="{!Webinar__c.Name}"/>
<apex:inlineEditSupport event="ondblClick" /><br/>
</apex:pageBlockSection><br/>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockTable value="{!wrapperAccountList}" var="w" id="table" title="All Accounts">
<apex:column value="{!w.acc.Login__c}"></apex:column>
<apex:inlineEditSupport event="ondblClick" />
<apex:column value="{!w.acc.isLead__c}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<center>
<apex:commandButton id="leadcreate1" value="Lead Mapping" action="{!doMappingPage}"/>
</center><br/>
</apex:pageBlock>
</apex:form>
</apex:page>
extension:
-----------
public class RedirectPage{
public PageReference doMappingPage(){
PageReference parentPage = new PageReference('/apex/MappingLeadPage');
parentPage.setRedirect(true);
return parentPage;
}
}
MappingLeadPage
----------------
<apex:page standardController="Lead" extensions="MappingLead1">
<apex:form >
<apex:pageBlock title="Lead Mapping" >
<apex:pageBlockSection >
<apex:pageBlock >
<apex:pageBlockSection >
Webinar Attendee Name <apex:inputField value="{!Lead.LeadFields__c}"/><br/>
Webinar Attendee Email <apex:inputField value="{!Lead.Lead_Fields1__c}"/><br/>
Webinar Attendee Company <apex:inputField value="{!Lead.Lead_Fields2__c}"/><br/>
Webinar Attende Mobile Number <apex:inputField value="{!Lead.Lead_Fields7__c}"/><br/><br/>
<!-- <apex:outputLink value="{!URLFOR($Page.Webinar_Details,w.acc.Id,[id=w.acc.Id])}">{!w.acc.name}</apex:outputLink> -->
</apex:pageBlockSection>
<apex:commandButton id="saveBtn" value="Save Mapping" action="{!processButtonClick}" style="margin-left:-2%"/>
<apex:commandButton id="saveBtn1" value="Previous Page" action="{!goBack}" style="margin-left:30%"/>
<apex:pageBlockButtons >
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
extension
------------
public with sharing class MappingLead1 {
public Lead login;
private final ApexPages.StandardController controller;
public MappingLead1(ApexPages.StandardController controller){
this.login= (Lead)controller.getRecord();
}
public PageReference goBack(){
PageReference pg = new PageReference('/apex/Webinar_Details');
pg.setRedirect(true);
return pg;
}
}
from the MappingLeadPage page by clicking the "Previous Page" button how i redirected to the Webinar_Details Page vf page.
Please anybody help i'm trying this logic from yesterday
Thanks In Advance
--
Thanks,
Prashant
@basha
its a url parameter when you want to redirect the user to when he clicks the previous button.
Check in your url and see if there is any retURL.
Are you using lightning or Salesforce classic?
--
Thanks,
Prashant
Ok..i thought you have retUrl in your VF..no worry.. you just need to get the current page id from url and then redirect to MappingLeadPage.
Get the current page id like then pass this id in the doMappingPage method.
Now you will see there MappingLeadPage with the previous record.
again in MappingLead1 class get the id as above shown. and now your goback method looks like below.
--
Thanks,
Prashant
public PageReference doMappingPage(){
PageReference pg = new PageReference('/apex/MappingLeadPage/id='+ids);
pg.setRedirect(true);
return pg;
}
}
in the above if i'm using like this oi got another error called
Id value a0N0K00001HzZ67 is not valid for the Lead standard controller please check it once i'm using two different standrd conrollers in two pages .Thanks
in goback method I didn't add the page name..you may add this '/apex/Webinar_Details'
Can you send me full class...and is Webinar_Details page is overridden on view button.
--
Thanks,
Prashant