-
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
How to Become a Salesforce Developer in 2024?
The world of customer relationship management (CRM) is undergoing a revolution, and at the forefront stands Salesforce, the undisputed king of cloud-based CRM solutions. But…
Batch Apex in Salesforce - Learn About the Advantages and Syntax
Batch class in Salesforce is utilized to run huge positions (think thousands or millions of records!) that would surpass typical handling limits. Utilizing Batch Apex,…
Can Salesforce Einstein AI Help in Sales Qualification?
Sales Qualification is an inevitable process and an important one for all sales teams. If you go to the market, you pick vegetables based on your…
Popular Salesforce Videos
Run Report With Filters from UiPath Studio | Salesforce
New features on Salesforce Activities Extention Package from UiPath MarketPlace: https://connect.uipath.com/marketplace/components/salesforce-activities-extention-package (0:40) Use complex object in the Query and Timeout part of the Setting to…
Reaching Potential Customers With Salesforce Marketing Cloud
Salesforce Marketing Cloud helps businesses in closely observing consumer behavior. Marketing Cloud has a number of platforms that are well-segregated and immensely useful in defining…
How to Learn Salesforce Development | Salesforce learning steps for beginners | Trailhead demo
In this video, we shared the steps to learn salesforce lightning basics, salesforce apex development, CRM in online for free from scratch very quickly. Learn salesforce…