+ Start a Discussion
ThomasmThomasm 

Button to create new record and recordtype

I currently have a page with a command button that creates a new record.  I would like to predefine the recordtype to the user goes directly to the page 

Here is what i currently have

<apex:commandButton value="Salary Time Off Request" action="{!URLFOR($Action.Forms__c.New)}"/>
Best Answer chosen by Thomasm
ThomasmThomasm
In case someone else needs this here is what worked

<apex:commandButton value="Rate Change" action="{!URLFOR('/a10/e?RecordType=012a0000001NWwY&ent=01Ia0000002Kw9e')}"/>
 

All Answers

Alexander TsitsuraAlexander Tsitsura
Hi Thomasm,

You need to pass string instead standard action in target attribute of URLFOR().
Here instead $Action.Forms__c.New provide '/FIRST_3_SYMBOLS_OF_FORMS_RECORD_ID/e?&RecordType=RECORD_TYPE_ID'

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you.

Thanks,
Alex
ThomasmThomasm
In case someone else needs this here is what worked

<apex:commandButton value="Rate Change" action="{!URLFOR('/a10/e?RecordType=012a0000001NWwY&ent=01Ia0000002Kw9e')}"/>
 
This was selected as the best answer