I have created a Visualforce Page to redirect users to Task's record type selection screen.The user selects a record type then the corresponding page layout opens where the user fills the data and once he clicks on Save, the page should redirect user back to the record type selection screen.

I am able to create the Task but once task is created i am redirected to the home screen.I need to redirect back to the record type selection page

Below is my VF page:

<apex:page controller="testctlr">
  <apex:commandButton value="Create Task" action="{!taskcreate}" />

Below is its controller:

public class testctlr{

   public Pagereference taskcreate(){
        return new PageReference('/setup/ui/recordtypeselect.jsp?ent=Task&nooverride=1&save_new_url=%2F00T%2Fe');
  • You can redirect to a previous page by using this: PageReference returnPage = new PageReference(ApexPages.currentPage().getParameters().get('retURL')); Of course the current url must contain the parameter 'retUrl'. Jan 5, 2017 at 13:03
  • @MartinLeze thanks for your reply.I am redirecting my VF page to the standard Task creation page.What should i sepcify in my retURL parameter to redirect it to the task record type selection page?I am trying to figure that out
    – Abhijeet
    Jan 5, 2017 at 13:27
  • Did you try this? return new PageReference('/01V/e'); Jan 5, 2017 at 13:30
  • Yes I did.It still redirected me to the home screen
    – Abhijeet
    Jan 5, 2017 at 13:33

1 Answer 1


I tested this and it worked:

public Pagereference taskcreate(){
        PageReference pageRef = new PageReference('/01V/e');
        return pageRef;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .