Auto populate field value while clicking on new button in reference field

abhsekpramanik3
Tera Contributor

Hi All,

 

There is one requirement to auto populate field value while creating new record from reference fields in the form.

There is one application called demand and in this form one reference field called "Project".

 

abhsekpramanik3_0-1689574288018.png

 

My requirement is that while I clicked the reference icon in the "Project" field and try to create a new record from there some field value should be pass from "Demand" record to project form .

 

abhsekpramanik3_1-1689574480380.png

 

abhsekpramanik3_2-1689574538734.png

 

Can you please provide any solution how it can be achieved.

 

Thanks,

Abhisek

 

 

4 REPLIES 4

Arun_S1
Tera Guru
Tera Guru

@abhsekpramanik3  When a user tries to create a new record from the reference field, as shown in your screenshots in the original post. ServiceNow framework will automatically pass the sys_id of the newly created record to the original screen where the lookup was initiated. Which means the newly created record will be automatically selected in the reference field.

 

I would recommend you to write an on change client script which should call a Server Side script (script include) through an AJAX call and retrieve the required values from the table and set those values in the client script.

 

Hope this helps.

 

Please mark the appropriate response as correct answer and helpful.

Thanks!!

Hi Arun,

 

My requirement is to pass the field values and sys_id from original form to newly created reference record to auto populate . Can you please suggest how to retrieve the field values and sysid in the newly created record.

 

Thanks,

Abhisek

@abhsekpramanik3 I got the requirement incorrect earlier, thanks for clarifying. Will check for possible options.

 

Thanks!!

Hi Arun,

 

Did you find any solution of this?

 

Abhisek