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
Shree KShree K 

Need help on URL hacking to pre populate Record Type Name and Parent Id

Hi All,
I have a custom object Interests (with only 2 Record types Primary and Secondary) which is a child to Account (lookup relationship) and Account has a Related List to create child records.

1) Standard Process : The standard "New" button lets the users to redirect and select the record type of their choice to create Child records(Interests).
what i am looking for is a customized solution (Probably URL hacking) with a custom list button which should redirect the users straight away to the edit mode and Prepopulate the Account (Parent ID) and the Primary (record type) on the  child record that is going to be created,in other words when the users are redirected from the Parent Record(Account) the child record that is going to be created should have the Parent Id in the lookup field and be with its record type as Primary.
I am thinking of 2 ideas:
1) Having a custom button, upon click the users would be on edit mode by auto populating Record type (in the standad field) and the parent ID.
2) Having a custom button which lets the users to a custom VF Page where there would be only a button, upon click of the button the record type will be populated as Primary and auto populating the Parent id when creating the child record.

Now all i need is a URL to make the things work, Please let me know if anyone has a better idea or with the possible apex work around for the URl part.

Thanks.  
Raj VakatiRaj Vakati
REfer this link 

https://developer.salesforce.com/forums/?id=906F00000008jRMIAY
https://www.salesforceben.com/salesforce-url-hacking-tutorial/
https://www.salesforceben.com/salesforce-url-hacking-tutorial/
https://cdcarter.github.io/2015/03/07/recordtype-hacking
https://threeheadsonapike.wordpress.com/2013/02/11/salesforce-url-hacking-prepopulating-fields/
https://www.topalovich.com/2012/09/create-a-custom-new-button-on-a-related-list-to-return-to-the-parent-record-after-clicking-save/
{tushar-sharma}{tushar-sharma}
Hi Shree,

Now URL hack is supported in Lightning Experience. Check below post for detail and code sample: 
https://newstechnologystuff.com/2020/06/03/salesforce-url-hack-in-lightning/
I5mailI5mail
These were extremely helpful:
  • https://newstechnologystuff.com/2020/06/03/salesforce-url-hack-in-lightning/
  • https://www.youtube.com/watch?v=O-7FwDfL-_Y
  • https://www.salesforceben.com/salesforce-url-hacking-for-lightning-tutorial/#:~:text=What%20is%20a%20Salesforce%20URL,record%20you're%20currently%20on