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(); 

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
|improve this answer|||||
  • Option 2 is great for me much thanks!! – cheuk law Nov 28 '19 at 7:42
  • You can accept the answer if it has served the purpose. – sanket kumar Nov 28 '19 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.