+ Start a Discussion

Any way to set default based on lookup up or some other procedure

I'd like to be able to set defaults when a user hits the "New" button on a custom object based on some simple logic.


Like set a value to a lookup from their User record?


Is there any way to do this or can defaults only be hard-coded values?


I guess the alternative would be to override the New button with some VF code but that's a heck of a lot of work to initialize a few fields.



You can use the url to set the default value ; by overridding the standard button and make a new button.




Have you explored using the "Default Value" option under "General Options" when defining a field ? That option allows you write some formula to come up with the default value for the field. Its available under Your Name -> Setup -> App Setup -> Create -> Objects -> <Object Name> -> Click Edit for the Field

Ken KoellnerKen Koellner

I looked at the options under a text field and checked what you can do with a default formula and see that I can set a default value based on a lookup to a related object.


My issue was with a pick-list field.  It appears that with a pick-list field, the only way to set a default is to check one of the values in the list.  You can't use a formula to set a default on a pick-list field.