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
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
Tera Patron

Hi @Rae Khan 

 

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

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

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