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
sfadm sfadmsfadm sfadm 

How to pre-populate fields when creating a new record?

I have a custom parent object A and a child object B.
When I create a new record from the child object B via the related list, only the parent lookup field is defaulted and filled in.
When I hit create new in the related list, I need to add more fields to be auto filled in.
Is there an appropriate solution to such issue?
Please advise.
NagendraNagendra (Salesforce Developers) 
Hi,

In lightning: you can do that using Set Predefined Field Values for Quick Action Fields https://help.salesforce.com/articleView?id=predefined_field_values.htm&type=5 . Here you predefine values for the new record created in quick action attributes and thus they get prepopulated when you click the quick action button.

In Classic: In classic, you can use URL hacking: Here you pass the FieldID and its value in URL params and they get set in the corresponding fields accordingly.

Src : https://help.salesforce.com/articleView?id=predefined_field_values.htm&type=5
Src : https://www.salesforceben.com/salesforce-url-hacking-tutorial/

Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra