i need to pass custom field value Email_id__c from one custom object Registration__c to another FeedbackFrom__c both objects are having different VF Pages how can i achieve this.
My Apex code is:
public class SampleEmail {
public Registration__c reg {get; set;}
public String emailId {get; set;}
public SampleEmail(ApexPages.StandardController controller){
reg = (Registration__c)Controller.getRecord();
emailId = reg.Email_id__c;
}
public void email() {
System.debug('This is your registered email' + emailId);
}
}
My 1st VF Page:
<apex:page standardController="Registration__c" extensions="SampleEmail" showheader="False" sidebar="False">
<apex:messages />
<apex:form >
<html>
<head>
<title>RegistrationPage</title>
<span style="display:block; margin:50px auto; text-align:Center;color:black;font-size:150%;">REGISTRATION PAGE - ONE TIME</span>
<style>
div.btnGroup1{
text-align:right;margin-top:-24px;margin-right:100px;
}
div.btnGroup2{
text-align:center;margin-top:30px;margin-right:550px;padding:8px*20px;
}
</style>
</head>
</html>
<apex:pageBlock >
<apex:pageBlockSection >
<apex:inputField required="true" value="{!Registration__c.Email_id__c}"/><br /> <br />
<apex:inputField required="false" value="{!Registration__c.Mobile_number__c}"/><br /> <br />
<apex:inputField required="false" value="{!Registration__c.Employee_number__c}"/> <br /> <br />
</apex:pageBlockSection>
<div class="btnGroup2">
<apex:commandButton value="Save" action="{!save}" styleClass="buttonStyle" style="background:thistle ;width:110px;height:25px;font-size: 14px"/>
</div>
</apex:pageBlock>
</apex:form>
</apex:page>
My 2nd VF Page:
<apex:page standardController="FeedbackFrom__c" extensions="SampleEmail" showheader="False" sidebar="False">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".bPageBlock").css("background-color","papayawhip");
$(".bPageBlock").css("border-color","papayawhip");
});
</script>
<style>
body{ background-color:papayawhip;}
</style>
<apex:form >
<html>
<head>
<title>Questionnaire8</title>
<style>
div.btnGroup{
text-align: center;margin-top:125px;margin-right:250px;padding:8px*20px;
}
body .bPageBlock .pbHeader {
background-color: Green;
}
</style>
</head>
<body>
<apex:commandButton action="{!email}" value="Registered email" styleClass="buttonStyle" style="background:thistle ;width:130px;height:25px;font-size: 14px"/>
</body>
</html>
</apex:form>
</apex:page>
But Am getting Invalid conversion from runtime type FeedbackFrom__c to Registration__c Error. Please Help me out from this issue