-
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 And Google Analytics Integration: All You Should Know
Are you looking for a tool that helps you manage and nurture your leads? Salesforce is a great choice. However, when it comes to generating…
5 Secrets to Master Salesforce for High Business Growth
What is Salesforce? Salesforce/Salesforce cloud is an intelligent ecosystem infused with AI and IoT that offers a variety of solutions to all-size enterprises, including non-profits, in…
How to Choose CRM for Your Organization
Organizations always prefer a single platform that is able to support all the business needs ... Organizations always prefer a single platform that is able…
Popular Salesforce Videos
Salesforce Apex Tutorial: Data Types
In this lesson, we are covering Salesforce Apex Data Types and we are covering primitive data types.
5 Strategies to Get a Salesforce Job with No Experience
If you have questions like how to jump start your Salesforce career as a freshers? Or what should be your approach to start Salesforce career?…
How to Learn Salesforce in easy step by step and get certified
From Salesforce instructor, Become a Salesforce Expert. Learn Salesforce step by step and get certified easily.