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.

populate data from another table fields

VSN
Tera Expert

I have 2 tables, 

1. program , it   contains portfolio and sub-portfolio

2. Change request, it contains portfolio and sub-portfolio,

common number between teo tables is  project number field 

here , i need to get value from porject portfolio to change request portfolio.  

i have written script include and client script , but it was displaying the after form got saved, but i need to display the portfolio and sub-portfolio values for new form.

 

script include:

siva62_0-1675961214010.png

Client script:

siva62_1-1675961283863.png

 

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

You need to change your client script from onload to onchange, and make it run onchange of u_program_name field.

-Anurag

View solution in original post

7 REPLIES 7

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

You need to change your client script from onload to onchange, and make it run onchange of u_program_name field.

-Anurag

But I need values for new record 

It will work for new record as well. When you add value to the field it will run.

-Anurag

Upender Kumar
Mega Sage

As suggested by Anurag, change the client script from onLoad to onChange of u_program_name field.

Now if the record is new then there is no value in u_program_name. That's why your script is not running onLoad.

Either you set a default value of u_program_name to run the script onLoad. But if you will change the value of u_program_name field before saving, it will not update the fields.....