Is it possible that pre fill value on the create page


public PageReference Create() { 
Contact tmp = new Contact (); 
tmp.Name    ='test123'; 
return new apexPages.StandardController(tmp).edit(); 

1 Answer 1


There are few ways you can pre-defined the fields i create form:-

  1. By using the Quick Action of type create a record. It Allows you to pre-defined the field values for the field available on the base object of the action. Read here for an working example:- REPLACING URL HACKS WITH PRE-DEFINED ACTIONS IN LIGHTNING EXPERIENCE
  2. If you are dealing with some complex scenarios, You can choose the Lightning Aura Component route and use force:createRecord to create a new record form with pre-defined values. It has an attribute called defaultFieldValues which gives you an ability to set the field values dynamically.
  3. You can go for Visualforce page also. Use the standardController and get the current record in constructor of the extension and manipulate the field values with your desired value. Check a sample example here:- Prepopulate Lookup Field in Standard Controller Visualforce Page
  • Option 2 is great for me much thanks!!
    – cheuk law
    Commented Nov 28, 2019 at 7:42
  • You can accept the answer if it has served the purpose. Commented Nov 28, 2019 at 7:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .