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
Adrian SameliAdrian Sameli 

How to call standard "new child record" window using JavaScript in VisualForce page

I'm trying to call the standard form to create a new related object in an overlay window, when loading a specific object detail page. That's how I would call the function:

<script> var previousOnload = window.onload; window.onload = function() { if (previousOnload) { previousOnload(); } alert('new related object...'); } </script>

How can I find the right function to call for any standard buttons? Like for example the "new" action on any related list? The action URL looks like this:

https://<domain>.lightning.force.com/lightning/o/<Related_Object>__c/new?count=5&nooverride=1&useRecordTypeCheck=1&navigationLocation=RELATED_LIST&uid=<RelatedID>&backgroundContext=%2Flightning%2Fr%2F<Parent_Object>__c%2F<ParentID>%2Fview

Thank you very much for your help.

VinayVinay (Salesforce Developers) 
Hi Adrian,

Using URL hack you can pre-populate field values but not create any popup on when onload.

Thanks,