Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Auto populate "Number" field from parent table to "Parent Request Number" field in Child.

Rahul J
Mega Expert

G'day all,

I've posted this question before but couldn't get the working solution for it. To begin with, I've a form (RJ Request) which have a field "Number" as shown in the screenshot below:find_real_file.png

Now, I want to auto populate "Number" field value onto "Parent Request Number" field of child form RJ Sub Task. Please find the screenshot below:

find_real_file.png

 

To serve this purpose I've created a Parent-Child Relationship b/w RJ Request and RJ Sub Task table. By creating a reference field in RJ Sub Task Table as "Parent Request Number". 

find_real_file.png

find_real_file.png

find_real_file.png

 

But as soon as I'm creating a Sub Task I cannot see "Number" populating onto "Parent Reference Number".

find_real_file.png

Can anyone please share any solution for this.

Cheers,

RJ

 

 

 

6 REPLIES 6

If you want to do it onload than you have to use client script. You cannot set value to read only field using client script.

Uncheck read only on u_parent_request_number field dictionary. than change back your business rule to below and enable client script.

change in your business rule is

var gr = new GlidRecord('u_rj_request');

if(gr.get(current.parent.sys_id)){

g_scratchpad.number = gr.sys_id;

I've amended those changes but still I'm unable to populate value into that field.

1.Unchecked Read Only- Parent Request Number

find_real_file.png

2. Applied this BR

find_real_file.png

3. OnLoad Client Script is applied and set to Active.

find_real_file.png