2

I have Task object with few record types. I created a custom List button on the task object and placed it on the related list of few objects. When i click this button i expected that it would prompt me to select a record type and then take me to the "New Task" page. But when i click on the button, it took me directly to the "New Task" page and the default record type was selected.

The code for the custom button is as below:

var url = '{!URLFOR($Action.Activity.NewTask)}'; window.location.href = url;

Does $Action.New not prompt to user to select Record Type?

8
  • That isnt valid javascript, its missing a semi colon. var url = '{!URLFOR($Action.Activity.NewTask)}'; window.location.href = url;
    – Phil Rymek
    Mar 28, 2013 at 14:53
  • This code is working. Only thing is that it does not prompt me to select the record type. It directly takes me to "New Task" page. Edited my Question. It was a Typo. Mar 28, 2013 at 14:57
  • Are all the Task Record Types available to the User's Profile or if it just has the one, which is default, that could be why it skips RT selection? Mar 28, 2013 at 15:15
  • yes..all task record types are assigned to the user profile..when i use Standard New Button..it does prompt to select the record type...but does not promt when using custom button. Mar 28, 2013 at 15:18
  • 1
    not sure if it makes a difference, but you might try using the task specific action, $Action.Task.NewTask instead of $Action.Activity.NewTask Mar 28, 2013 at 17:56

1 Answer 1

2

The record type selection page is only displayed when needed (meaning whenever the record type cannot be pre-determined). The page is skipped when either 1) the user's profile only has access to one record type for the object or 2) they've set a default record type in their personal settings (setup->my personal information->record type selection).

The output of {!URLFOR($Action.Task.NewTask)} takes this into account and will direct a user to either the record type selection page or the new task page depending on whether any of the conditions above are listed.

6
  • In that case it should behave the same when I use standard New button. But it prompts me when I use standard button. I have not set the default record type and I have multiple record types assigned to my profile. Mar 28, 2013 at 17:19
  • As a last resort, I guess, I might have to hard code the url if I cant find a way out here. Mar 28, 2013 at 17:21
  • Not sure what to tell you, you're either doing something wrong or your org has a bug. I've tested this and the answer to your last question and they both work. Mar 28, 2013 at 17:25
  • NP Ralph. BTW, I am testing this in my own dev org, not the company's org. The above is the only code that I have written for the custom button. Mar 28, 2013 at 18:40
  • Thanks Ralph. I chenged the code from {!URLFOR($Action.Activity.NewTask)} to {!URLFOR($Action.Task.NewTask)} and it worked. Not sure why it didnt work the other day. Apr 8, 2013 at 9:40

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.