Auto populate reference field value on new form for another table from related list new button
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 11:14 AM
Hi Team,
Can someone help me with the requirement where :
I have created a relation between two tables both are extended from task, if I am creating a new record from related list New button the field should auto populate.
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 07:26 PM
@Pravin11 Which field should auto-populate? Parent info on child table record?
- The built-in behavior in ServiceNow let you populate the info on child record if you have that reference properly.
- Or You can create an OnLoad Client script on child table which Parses the URL for the sysparm that the related-list “New” button sends
var val = g_form.getParameter('sysparm_' + myRefField);
if (!val) {
var a = g_form.getParameter('sysparm_query') || '';
var b = q.match(new RegExp(myRefField + '=([^&]+)'));
val = b && b[1];
}
if (val)
g_form.setValue(myRefField, val);
If that helps, please mark my answer helpful
Thanks