2

I have a new custom VF page for the button Log a call but I want to use this page only when user selects the General Inquiry for everything else it should go to standard page.

How do I do this?

Below are screenshots on what I am talking about:

enter image description here

enter image description here

EDIT:

I tried the below code but looks like it is in a infinite loop:

VF page:

<apex:page showHeader="true" sidebar="true" 
            standardController="TASK" tabStyle="Task" 
            extensions="TaskVFPageExtension" action="{!urlRedirect}">

Controller:

public PageReference urlRedirect() {
    String selectedRecordType = ApexPages.currentPage().getParameters().get('RecordType');

    Id recTypeId = Schema.SObjectType.Task.getRecordTypeInfosByName().get('General Inquiry').getRecordTypeId();

    if(String.valueOf(recTypeId) != selectedRecordType){
        PageReference currentPage = ApexPages.currentPage();
        currentPage.getParameters().put('nooverride','1');
        currentPage.setRedirect(true);
        return currentPage;
    }else{
        return null;
    }

}
  • 1
    Override the Log a call button to take to a VF page, controller checks for record type via page action method and if should go to standard, redirects using the nooverride=1 parameter, otherwise stay on the vf page – Eric Aug 23 '15 at 19:33
  • @Eric I tried the above code(edited the question)..Could you please let me know what is wrong with this code? – javanoob Aug 23 '15 at 20:07
  • @Eric , Nevermind..I figured out how to get query parameters from the current URL and prepare a new URL and add the parameter nooverride=1..Thanks for the idea on how to solve this. – javanoob Aug 23 '15 at 20:46
  • Ok, posted as an answer so you can accept and the question does not keep surfacing – Eric Aug 23 '15 at 21:11
5

Override the Log a call button to take to a VF page, controller checks for record type via page action method and if should go to standard, redirects using the nooverride=1 parameter, otherwise stay on the vf page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.