function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sandra WicketSandra Wicket 

Override Standard Edit Page for specific RecordType

Hey Guys, 

i have created a visualforce page which overrides the standard edit page.  The Controller defines which record type is linked to another visualforce page. That works fine, but for some record types i want use the standard edit page. Here is the controller :
 
public PageReference redirect(){
        IF(ev.Recordtype.Name.equals('A')){
           rPage = Page.A;
               } else if(ev.Recordtype.Name.equals('B') ) {
                   rPage = Page.B;
               }else if(ev.Recordtype.Name.equals('C')){
                   rPage = Page.C;   
               }
        		else if(ev.Recordtype.Name.equals('D')){
                   rPage = Page.D;   
                }
        
        		else if(ev.Recordtype.Name.equals('E')){
                   rPage = Page.E;   
               }
        		
        else {
            rPage = Page.Event_StandardEditPage;     // Here i want the standard edit page 
        }
        return rPage;
Greetings Sandra


 
Best Answer chosen by Sandra Wicket
Raj VakatiRaj Vakati
You can do an URL hack for the edit standard page 

like below 


/0014600001R7Et8/e?retURL=%2F0014600001R7Et8
public PageReference redirect(){
        IF(ev.Recordtype.Name.equals('A')){
           rPage = Page.A;
               } else if(ev.Recordtype.Name.equals('B') ) {
                   rPage = Page.B;
               }else if(ev.Recordtype.Name.equals('C')){
                   rPage = Page.C;   
               }
        		else if(ev.Recordtype.Name.equals('D')){
                   rPage = Page.D;   
                }
        
        		else if(ev.Recordtype.Name.equals('E')){
                   rPage = Page.E;   
               }
        		
        else {
            rPage = new PageRefernce('/0014600001R7Et8/e?retURL=%2F0014600001R7Et8
')     // Generate this URL dynamically
        }
        return rPage;

http://www.salesforceben.com/salesforce-url-hacking-tutorial/


 

All Answers

Raj VakatiRaj Vakati
You can do an URL hack for the edit standard page 

like below 


/0014600001R7Et8/e?retURL=%2F0014600001R7Et8
public PageReference redirect(){
        IF(ev.Recordtype.Name.equals('A')){
           rPage = Page.A;
               } else if(ev.Recordtype.Name.equals('B') ) {
                   rPage = Page.B;
               }else if(ev.Recordtype.Name.equals('C')){
                   rPage = Page.C;   
               }
        		else if(ev.Recordtype.Name.equals('D')){
                   rPage = Page.D;   
                }
        
        		else if(ev.Recordtype.Name.equals('E')){
                   rPage = Page.E;   
               }
        		
        else {
            rPage = new PageRefernce('/0014600001R7Et8/e?retURL=%2F0014600001R7Et8
')     // Generate this URL dynamically
        }
        return rPage;

http://www.salesforceben.com/salesforce-url-hacking-tutorial/


 
This was selected as the best answer
Sandra WicketSandra Wicket

Thanks Raj, 
i thought URL Hacks are not best practise, but i wil give it a try. 

Greetings Marry