function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
avlerikavlerik 

Pre-populate ID/Name field with a picklist value when creating new record of custom object

What I'd really like to have is the ability to define a picklist rather than an Auto-Number or a text field as the Name/ID field of a custom object. Since this currently isn't possible, the next best way is to intercept the "New Record" event, offer a page that provides the desired picklist and then populate the Name/ID field in the object's Edit page with the selected value.
 
Here are my problems:
(1) does anybody have a code snippet for creating such a page and populating a picklist with a list of values?
 
(2) does anybody know of a way to pre-populate a read-only (!) field with a customized URL? Populating an editable field in Edit mode is fairly easy, but I just can't figure this out if the field is defined as read-only on the page layout.
 
Any help is appreciated.
 
Thanks,
Erik
FreshFresh
You can't feed in a value to a read-only cell, but you could make an S-Control button that creates the record, saves it, and then sends the user to the edit page of the record. This can be accomplished with a fairly straight forward OnClick Javascript button. The only issue with this solution is that if the user clicks to create a new record, and then hits cancel, the record is still created.

Hope this helps!