-
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
Salesforce Ant Migration Ubuntu
Copying data is a very powerful tool. We all have done that in our High schools, copying assignments. It also plays a significant role in…
How Salesforce Consulting Powers Business Growth
Have you ever wondered why, despite using the same tools and technology, some businesses seem to grow with ease while others struggle? The difference lies…
Salesforce CPQ Overview: Installing, Sales Cloud Integration and more
CPQ in Salesforce stands for "Configure, Price, Quote." This Salesforce software is designed to optimize sales processes, specifically product configuration, pricing, and quoting. The…
Popular Salesforce Videos
Create Customers for Life with the Loyal Program in Salesforce
Ever thought about how you can retain your customers in this cutthroat competition in this growing market? A customer loyalty program is one of the…
From ₹5000 Salary to Salesforce MVP - Journey of a Small Village Boy
Story of Salesforce MVP Amit Singh Session Includes: [00:14:00] ? How Amit Singh started his career in Salesforce as a Fresher. [00:30:45] ? How Amit…
Hello (Salesforce) World - An introduction to Tableau Developer
Hello, Salesforce world! Curious about Tableau (the newest member of the Salesforce family), our developer platform and suite of developer tools available? Whether you are…