You need to sign in to do that
Don't have an account?
Jon Keener
New Button Override and RecordType Selection
We've got some custom objects in Salesforce where we currently require our end users to click a web link on an account to create. The web link is basically passing information via the URL to fields on the edit screen. In addition, it enforces that the recordtype is always "New". The users have access to other recordtypes, which the these new records eventually become, but they always need to start at "New".
With the Winter 07 release, I'm looking at the options of either removing the standard New button totally, and potentially overriding the "New" button with similar code as the weblink to pass information to the edit screen. I would prefer to override the "New" button, since it shows up in the related lists, along with the hover button related lists.
However, it appears that when you override the "New" button with an s-control, it going to the recordtype selection screen prior to running the s-control. There does not appear to be a way to have the "New" button force a recordtype like a weblink can.
Is anyone aware of any way to avoid the recordtype selection screen when overriding the "New" button on an object? Short of adjusting the profile of the user to only let them create new recordtypes, (which isn't feasible here, since the user later changes the recordtypes) I haven't been able to figure out a way.
Thanks!
Jon Keener
Please promote this idea if it interests you:
http://ideas.salesforce.com/article/show/64598/Override_the_New_button_and_skip_the_Record_Type_selection_page
Message Edited by mscotton on 03-27-2007 02:36 PM
Maybe I'm missing something here but I created a record type for Accounts and then selected New and then selected that record type. I then looked at the URL and pulled out the RecordType=01250000000DOje value. I then added this as the first passed value of the URL for the button and it takes me right to the Account record type I wanted. My whole URL is below and you would have to change the ID to your ID and make sure the server is correct but you should be able to jump right to the record type without requiring your users to select it themselves.
https://na3.salesforce.com/001/e?RecordType=01250000000DOje
Please let me know if I'm not understanding the issue.
Continuing this discussion - is it even possible to work at all with an overridden new button if there is a recordtype?
I tested out a simple solution to autofill some fields that works fine until RecordTypes are introduced. Without the recordtype selection, this code works fine:
window.parent.location.href="{! URLFOR( $Action.Contact.NewContact , null, [con4= $User.Preferred_Community__c], true)}";
However, with recordtype turned on, the page shows for a second and then redirects to an error url:
https://na1.salesforce.com/servlet/servlet.Integration?lid=01N300000000dYf&ic=1#Error!
I tried various things to get around this:
- passing Recordtype="xxx" as a parameter, but got the same error
- Using a copy of the URL I got after creating a new contact, and inserting in the con4 parameter, but the browser continually reloads every couple of seconds
- I tried setting a default recordtype for my test user, but got the error mentioned above.
If this override is not possible, perhaps there is some other way to accomplish the auto fill?Thank you,
John
http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=1737
But I don't think it will work. I think that there will be no way to skip the override and thus end up in an infinite loop again. So please vote for the feature as mentioned above.
As stated, you can't override the record type choice if people are able to choose one. However, the code below does mean that if the user is set to use their default record type for a new contact (in their personal set up), this will at least set a different record type for the contact if the "if" statement evaluates to true:
This is designed to check if the new contact is launched from an account, or from the contact screen. If from an account, it sets the account as the contacts account, and choose a specific record type
If from the new contact screen, if will use the users default record type, and set the account name to be a default (In this example, "Default Account Name")
Code:
Hi,
One very annoying thing I'm seeing related to this. I overrode the New Account button to call an scontrol to check the user's profile before letting them create the Account. If they're allowed, I redirect with:
window.parent.location.href="{! URLFOR( $Action.Account.New , null, [retURL="/001/o"], true)}";
But when the user has access and reaches the record selection page and clicks Continue the page just submits and presents record selection again (no validation error or anything). It seems if I choose another record type in the pulldown and hit Continue it goes through and creates the record. Any idea what's causing this? Any help is much appreciated.
Thanks
you need to add &RecordTypeoverride=1 to the query string
have your VF page redirect to your normal page layout
for example:
<apex:page standardController="Event">
<script>
window.location.href = '/00U/e?RecordType=01240000000DspW&ent=Event&nooverride=1';
</script>
</apex:page>
then override your button with this VF page and check off Skip Record Type Selection Page