You need to sign in to do that
Don't have an account?
Override Page
I need your help, I'm overriding the "New" and "Edit" button of Accounts deppending of the profile of the user.
For some profiles there will be showed x page (I'have developed that and that's ok) but the problem is when I want for some users to show the standard "new" or "edit" salesforce page. How do I get that!!??
I use this code to show x page (I don't have problems here)
if (USER_PROFILE == '00e40000000wksvAAA') { PageReference PageRef= new PageReference('/apex/pagex'); PageRef.setredirect(true); PageRef.getParameters().put('id', ID); return pageRef; }
I use this other when a user doesn't have access to this option (I don't have problems here)
else return null;
What do i need do if I want that certain profile goes to the standard salesforce page to add or edit a record???
Check the below code. I implemented something similar. Here, the important part is to user nooverride=1. If that is not used, you will again redirected to the override edit page and thus run in an infinite loop.
PageReference redirectURL;
if(newRecType)
redirectURL = new PageReference('/apex/myEditPage?' + caseId + '&action=Edit' + '&retURL=%2F' + caseId);
else
redirectURL = new PageReference('/500/e?id=' + caseId + '&nooverride=1' + '&retURL=%2F' + caseId);
Thanks a lot for posting this!!!! It's working fine.