[SalesForce] URLFOR on VF Page – Help with specifying record type

I have the following URL on a VF page. I want the link to take you to the details entry point and not the record type picker screen which is currently happening. I can't find a good documentation point for what the input parameters are for URLFOR function. Can someone tell me what to tweak to make this work?

<apex:outputLink value="{!URLFOR($Action.Admin_Tracking__c.New, null, [p3='012230000004LDD', save=1])}" target="_blank">Advanced Entry</apex:outputLink>

Best Answer

Your parameter is incorrect and to answer your question of URLFOR Explained:

<apex:outputLink value="{!URLFOR($Action.Admin_Tracking__c.New, null, [RecordType='012230000004LDD', save=1])}" target="_blank">Advanced Entry</apex:outputLink>

http://salesforcesource.blogspot.com/2008/12/urlfor-function-finally-explained.html

{!URLFOR(target, id, [inputs], [no override])}

Parameters shown in brackets ([]) are optional.

  • target: You can replace target with a URL or action, s-control or static resource.

  • id: This is id of the object or resource name (string type) in support of the provided target.

  • inputs: Any additional URL parameters you need to pass you can use this parameter. you will to put the URL parameters in brackets and separate them with commas ex: [param1="value1", param2="value2"]

  • no override: A Boolean value which defaults to false, it applies to targets for standard Salesforce pages. Replace "no override" with "true" when you want to display a standard Salesforce page regardless of whether you have defined an override for it elsewhere.

Although, this will not do what I suspect you actually want and bypass the record type selection page. Currently no way to do that using URLFOR

Alternate way of doing this: Build the url

http://blog.jeffdouglas.com/2010/03/30/short-cut-the-recordtype-selection-step/

/006/e?retURL=%2F{!Account.Id}&accid={!Account.Id}
&RecordType=YOUR-RECORDTYPE&cancelURL=%2F{!Account.Id}

Related Idea: https://success.salesforce.com/ideaView?id=08730000000BrRqAAK

Alternate solution: if you only have one record type assigned to each profile then the selection screen will not be presented

Related Topic