-
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
Integration Using Named Credentials | Salesforce Developer Guide
The Following are the Benefits of Using Named Credentials: A Named credential specifies the end URL of the callout and its verification parameters required in…
Role of a Salesforce Admin in Maintaining the Org | All You Need to Know
Salesforce is one of the most popular customer relationship management (CRM) platforms in the market these days. It has become a critical tool for organizations…
Getting Started with Salesforce Lightning Scheduler
If scheduling appointments is a consistent problem in your business, or you need to upscale your current system, try the Salesforce Lightning Scheduler. This add-on…
Popular Salesforce Videos
EPC and CPQ in Salesforce Industries (Vlocity)
Enterprise Product Catalog (EPC) to configure and manage CPQ in one place. It's a guided selling experience for users to build an order. While CPQ…
How to Become a Salesforce Consultant at Any Age
Companies are in great demand of skilled Salesforce consultants as a means to achieve their Salesforce objectives for better output in their business. With the…
How to Start a Process with Parameters on UiPath Robots from Salesforce Interface
How to start a process with parameters on UiPath Robots from the Salesforce interface. Watch this video and learn. Let us know in the comments…