-
Bug: Redirect on to custom VisualForce page on click of record (Condition Based). How to fix this?
Recently come up with a situation that on clicking a record it redirects me to an custom vf page on certain condition rather than on the detail page of Salesforce record.
I have changed the view button to override on to my vf page, but the error that I'm facing is
"An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.Thank you again for your patience and assistance. And thanks for using salesforce.com!
Error ID: 178978640-125263 (-1373969722)".
Below is my code:-
public with sharing class DetailPageOnClickingRecordCls {
public id accId{get;set;}
public Account accountDetail{get;set;}
public string accName{get;set;}public DetailPageOnClickingRecordCls(ApexPages.StandardController controller) {
}public PageReference doTest(){
accId = ApexPages.currentPage().getParameters().get('id');
accountDetail = new Account();
accountDetail = [select id,name from Account where id =: accId];
accName=accountDetail.name;
system.debug('accName::'+accName);
system.debug('accountDetail::'+accountDetail.id);
PageReference pageRef;
if(accName.substring(0,1)=='A'){
pageRef = new PageReference('/apex/DetailPageOnClickingRecord');
pageRef.setRedirect(false);
system.debug('hello in if');
//return pageRef;
}
else{
pageRef = Page.SelectableAccountPaginationDemo ;
pageRef.setRedirect(false);
system.debug('hello in else');
}
return pageRef;
}
}
Log In to reply.
Popular Salesforce Blogs
From Amateur to Pro: How Salesforce's Customer Success Platform Drives Results
Customer success experts are in high demand because you can make good money with it. It's about pipeline growth, customer retention, and loyalty, which is…
Learn About Apex Web Services Unit | Salesforce Developer Guide
Apex Web Service You'll uncover your Pinnacle lesson strategies as a REST or Cleanser web benefit operation. By making your strategies callable through the net,…
Market your Brand Like a Superstar with New Salesforce Marketing Cloud March 2020 Features
For all Salesforce lovers, New Year celebrations begin only when Salesforce release their product updates. So, it is Happy New Year for us all as…
Popular Salesforce Videos
PASS Salesforce Certified Administrator Exam on the FIRST Attempt
Want to pass the Salesforce Certified Administrator Exam on the FIRST Attempt? Then this video is for you. Here are the steps: STEP 1 :…
What Is Loyalty Management in Salesforce? | Video Tutorial
In the past few years, we have come across terms such as loyalty programs and loyalty management. Let's understand the concept of loyalty management with…
Different tools use to code in APEX | APEX Basics | Salesforce Development Course
Are you aware of the tools that are used for writing codes in APEX? Here are the different tools that you can use to write…