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
Dharmendra Kumar 60Dharmendra Kumar 60 

Create a related contact using URL hack passing AccountId

I am trying to create related conact to an account passing the accountid into the url,url heck doesn't work properly when JS hits the url and opens a new window ' Account name doesn't auto populate in the new contact window in Lightning'-

https://dharmendraex-dev-ed.lightning.force.com/lightning/o/Contact/new?Accountid=0017F00000C34HOQAZ

Am I missing something? Please help me out on this .
 
Prady01Prady01
Hi there, You wont be able to achive this in the lightning UI. This can be done in classic but in lightning you got find another way like quick action.

Hope this helps!
Prady01 
Dharmendra Kumar 60Dharmendra Kumar 60
Hi ,
Thanks for your reply. Please guide me with a proper approach ,so that I can proceed on this.
Thank you
Prady01Prady01
You should be able to create a new quick action button. After this there are 2 ways to do it.
1) There is standard way. This is standard out of the box functionality in salesforce. The fields displayed will be dependent on the object kayout you are showing up in the POP-UP. Even in this we can pre-populate the fields that are necessary.
2) This is custom way to do it. Here you will have to create a lighting quick action component. Even in this if you create record event you can prepopulate the necessary fields.

Hope this helps!
Prady01
Anil Bolisetty 2Anil Bolisetty 2
 Please use below code in js file to hack url in lighnting
const parsedUrl = new URL(window.location.href);
and get the value using  parsedUrl.searchParams.get("accountid")