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

Prepopulate custom fields

Im using URL Hacking to pre populate the custom fields.  Its working fine with the object which does not have a record type.


I have created a custom object for this.


How to do this on the object which have a record type.??


Hi Chiranth


I'm assuming that your field assignment are complicated and cannot be solved using the formulas in the default value of the fields.


if that is the case, you can override the New button of the object to lead to a visualforce page that you write.

this page shoud basically replace the record type selection page - allowing the user to select from the available record types.

use a "with sharing" controller for your visualforce page to avoid security issues and prepopulate a select list in the visualforce in the controller constructor.


in the event handler that handles the button the user clicks to confirm his/hers selection, return your hacked page reference inclunding the selected

record type.


coded correctly, you can probably get away with a generic visualforce page that receives the context (the object type being created) as a url parameter, and builds on that from there.


Hope this helps.



And please mark it as resolved if it solves your issue.




Here's a great post on how to do this. Search on "recordtype" for an example of how to do it for recordtypes:


Good luck!