[SalesForce] the difference between {!URLFOR($Action.Activity.NewTask)} and {!URLFOR($Action.Task.NewTask)}

When you try to create a custom button for a Task, if you choose "$Action" in the "Select field type", you have two options to define that button:

  1. $Action.Activity.NewTask – This will take you to a New Task page directly bypassing the record type selection page and assigns the Default Record Type to task.

  2. $Action.Task.NewTask – This will first take you to the Record Type Selection page if there exists any and then to the New Task page.

I want to know why 2 different actions exists as and why these two actions behave differently.

Here is a Link to my other question which made me ask this question.

Best Answer

The reason the two different actions exist is because there are different record types that may exist which are appropriate for the Task. In some orgs, they consider all Tasks to be related to a specific record type (often related to the WhoId which points to the account) which they default it to. When that's the case, it bypasses the dialogue where they assign a Record Type.

In other orgs, it appears that's not the case and there may be more than one appropriate Record Type for a Task. When that's the situation, the user is expected to choose the correct Record Type to assign to the new Task.

For more on this, you might also want to look at this discussion.

EDIT

Here's some more from page 123 of the Visual Force Developer's Guide:

"Custom buttons and links are available for activities under the individual setup links for tasks and events. However, you can override a button that applies to both tasks and events by clicking Your Name > Setup > Customize > Activities > Activity Buttons."

From the above, I'd conclude that its possible the org (or user) may have overridden the default properties for either the buttons or pages they're using to create tasks and/or events.

Note: There are separate buttons for Tasks and Events. Ditto for Activities. Any of the three could have custom page layouts. Events and Activities share the same "out of the box" standard page layout, which doesn't preclude an architect from creating a separate one for each of them which I've regularly seen in the orgs I've worked in.