-
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
Main Features of Salesforce Summer’22 Release to Make Your Customers Happier
Even though the sandbox preview with early access to new features and test configurations of the Summer’22 release was held on May 6-7, the production…
Salesforce Consulting Services: A Salesforce Consultant's Overview of Available Services
Salesforce is the most widely used platform for customer relationship management (CRM), and it is selected by businesses that want to analyze and manage customer…
Debugging in Salesforce | All You Need to Know
Debugging is a key part of software development, including Salesforce development. Debugging in Salesforce is the process of identifying and fixing errors or problems in…
Popular Salesforce Videos
How to Connect to External Data | Salesforce
An external data source specifies how to access an external system. Salesforce Connect uses external data sources to access data that's stored outside your Salesforce…
Einstein Opportunity Scoring For Everyone | Salesforce
Let artificial intelligence help you and your sales team focus on the right opportunities and close more deals. See how Einstein Opportunity Scoring makes it…
Agile in Salesforce | Agile Salesforce Implementation
Watch this video to learn about Agile Salesforce Implementation When Salesforce met Agile Agile vs Waterfall Introduction to Scrum Scrum Roles Scrum Ceremonies Q&A