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
jvelazquezjvelazquez 

how to capture the parentid into child object whose record has been created from the Related List

Hi 

 

I have scenario where PartnerNew is a Child object to Account. When I am trying to create PartnersNew record from the related list of account I am not able to capture the parentID of that related record. I am only getting the parentID of the record to which it is looking up.

 

 For example I clicked on an Account ABC . ABC account has a related list PartnerNew with no records. I click on New PartnersNew , What I want is to capture the ParentID of ABC record into PartnersNew. Is this Possible. I tried to capture this through visualforce and Javascript  but not through salesforce triggers.

 

Please provide me with inputs

 

Thanks in Advance

Best Answer chosen by Admin (Salesforce Developers) 
Avidev9Avidev9
I guess you can replace the new button with your own custom button. Now from your custom you can use url hacking to pass the parent Id.

Have a look at this blog for further details on url pre-populating fields http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html

All Answers

Avidev9Avidev9
I guess you can replace the new button with your own custom button. Now from your custom you can use url hacking to pass the parent Id.

Have a look at this blog for further details on url pre-populating fields http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html
This was selected as the best answer
Marko LamotMarko Lamot

so, if I understand, you implemented visualforcepage for NEW for PartnerNew Object. And you wan't to have here account parent id.

if that is the case, write controller of PartnerNew object where you would retrieve acccount parent.

----

if you just want that account parent is prepopulated on some field of PartnerNew layout (when creating it from account related list), you can use URL "hacking"....