We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Modify Related List New Button

Rae Khan
Tera Contributor

Hi all, 

 

I have a Parent Form A and a Child Form B. 

The Child Form is connected to the Parent Form through a Related List on the Parent Form. 

When a user clicks on New on the Parent Form within the Related List, they are redirected to the Child Form. 

 

I would like to modify the New Button on a Related List such that when it is clicked, several fields on the Child Form are autopopulated based on the Fields from the Parent Form.

 

How should I go about this?

Any help would be greatly appreciated, thank you 

3 REPLIES 3

Siddhesh Gawade
Mega Sage

Hello @Rae Khan ,

 

You can create a onload client script on form B table to autopopulate fields. See the below example:

function onLoad() {
//Check if the form is a new record
if (g_form.isNewRecord()) {
var parentRec=g_form.getReference('parent',test); // instead of parent you can use appropriate field which is pointing to record from form A.
function test(response)
{
g_form.setValue('short_description', response.short_description); // using this you can set multiple fields from form A
}
}
}

Hello @Rae Khan ,

 

Does this resolved you issue ? If yes, It would be great if you mark my response as CORRECT or Helpful so that others can see this on top of the list and get benefited by this.

 

Thanks & Regards,

Siddhesh

Dr Atul G- LNG
Tera Patron

Hi @Rae Khan 

 

You can check the logic of change and change task. OOTB UI action is there.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG

****************************************************************************************************************