+ Start a Discussion
Prasad RuwanpathiranaPrasad Ruwanpathirana 

Can we display parent object details in child object's page layout?

I need to display parent object details on a child object's page layout once it creating.Not after creating. And we need to do this without creating a visual force page. Can you please let me know is it possible?
Best Answer chosen by Prasad Ruwanpathirana
RamuRamu (Salesforce Developers) 
The only way to do this without using Visualforce page is to create a listbutton and use the script something as the below

{!URLFOR($Action.Contact.NewContact,'',[accid=Account.Id,name_firstcon2="Ramu",name_middlecon2="Adep"])}

For example, if you want to create a new contact record from the related list of Account record, you would need to follow the steps below

1. Go to Setup-->Customize-->Contact-->Buttons, Links and Actions
2. Click 'New button or link'
3. Enter the label name
4. Select the Display type as 'List Button'
5. Enter the above script in the body formula/script editor section.

Points to Note : If you want to add more values from the parent record, all you would need to do is get the corresponding id of the child object field. How would you do it? it is simple, if you are working on chrome/mozilla right click and go to Inspect element. Review the link corresponding to that field, you would find the id of that particular field. Copy the id and put it in the script you can put as many number of fields as possible seperated by commas

Hope this helps !!
 

All Answers

RamuRamu (Salesforce Developers) 
The only way to do this without using Visualforce page is to create a listbutton and use the script something as the below

{!URLFOR($Action.Contact.NewContact,'',[accid=Account.Id,name_firstcon2="Ramu",name_middlecon2="Adep"])}

For example, if you want to create a new contact record from the related list of Account record, you would need to follow the steps below

1. Go to Setup-->Customize-->Contact-->Buttons, Links and Actions
2. Click 'New button or link'
3. Enter the label name
4. Select the Display type as 'List Button'
5. Enter the above script in the body formula/script editor section.

Points to Note : If you want to add more values from the parent record, all you would need to do is get the corresponding id of the child object field. How would you do it? it is simple, if you are working on chrome/mozilla right click and go to Inspect element. Review the link corresponding to that field, you would find the id of that particular field. Copy the id and put it in the script you can put as many number of fields as possible seperated by commas

Hope this helps !!
 
This was selected as the best answer
RamuRamu (Salesforce Developers) 
You can review more about URLFOR in the below article

http://salesforcesource.blogspot.sg/2008/12/urlfor-function-finally-explained.html