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

How to get the Record Name prepopuated while creating a New Record??

Hi All,


Inside an Opportunity i have a custom object "opportunity_proposals__c", as i click on the 'New Opportunity Proposal' button in the related list, a new page of Opportunity Proposal gets opened to create a new record.... i want the 'Opportunity Proposal name' field should gets prepopulated with an Opportunity name....


i have written a trigger for this...


trigger ProposalName on opportunity_proposals__c (before insert)

String Prop = 'Proposal';
a.Name = a.Opportunity__c + Prop ;



I need to prepopulate the Name field with the Opportunity Name.. while creating the new record....


i hope i have explained the requirement.. pls let me know if anything else is required....






I understand that you have created an custom object called Opportunity which is either has a lookup reference or a master-detail relationship with Opportunities.

In such a scenario ensure that you include custom object in the related list of the Oppurtunites view page. To do this you may edit the page layout of the opportunity.


Open an Opportunity and then click on the new opportunity proposals from there and the opportunity field will automatically show the Opportunity name. 


The other way would be a tedious workaround using visualforce and apex.





You can use formula field instead of trigger. Create a formula field in ‘Opportunity Proposal’ object and in formula give the value ‘’. Whenever you create a record of opportunity proposal, the formula field  will get the value from parent object’s record.