You need to sign in to do that
Don't have an account?
how to redirect to the detail page
Hi guys,
please help me to redirect to the detail page on click a button.
Public Class Comments{
public Comments__c Com{get; set;}
id str;
id str1;
public Comments(ApexPages.StandardController controller) {
Com=(Comments__c)controller.getRecord();
str=Apexpages.currentpage().getparameters().get('id');
System.debug('======================================>'+str);
}
public Comments(){
List<Comments__c> c=[select id, Contact__r.Id ,Finance__r.id, Application__r.Id from comments__c where id=:str];
if(c!=null){
for(Integer i=0;i<=c.size();i++){
str1=c[i].Contact__r.Id;
system.Debug('--->'+str1);
}
}
}
public PageReference lead() {
PageReference pageRef = new PageReference('/00Q/o');
return pageRef;
}
public PageReference Applicant() {
PageReference pageRef = new PageReference('/'+c.Contact__r.id);
return pageRef;
}
public PageReference Application() {
PageReference pageRef = new PageReference('/'+c.Application__r.id);
return pageRef;
}
public PageReference Finance() {
PageReference pageRef = new PageReference('/'c.Finance__r.id);
return pageRef;
}
}
i am calling the page reference on a button click.when i click that button then they should redirect to that record detail page.
Thanks
$F
I don't thnk you can use 'c' as that's a local variable to the constructor. You'll need to store the value in the controller somewhere. Something like:
Ideally these methods would check whether comWithRelated is null first, but I've left that as an exercise for the avid student.