How to display value on lookup field based on reference field?

Jessica28
Tera Guru

Hello,

I have a custom table with two columns, Project Number and Project ID

Table:

Jessica28_0-1709054790236.png

 

When user select a project number, I would like the project id to displays in the project id field.  Please help.  Thanks you.

 

Here are the fields:

 

Jessica28_2-1709055522573.png

 

 

2 ACCEPTED SOLUTIONS

Sumanth16
Kilo Patron

Hi @Jessica28 ,

 

please refer to below thread:

https://www.servicenow.com/community/itsm-forum/populate-lookup-selectbox-choice-based-on-reference-...

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

View solution in original post

SanjivMeher
Kilo Patron
Kilo Patron

Hello @Jessica28 ,

 

If it is a table form, where you would like the display the project id, open the form layout and expand the Project field. After that look for Project id and add it.

 

If it is a catalog form, you need a onChange client script to populate the Project ID.

ex

var ref2 = g_form.getReference('project_number',callBack2);
function callBack2(ref2){
	g_form.setValue('project_id',ref2.support_group);
}

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

5 REPLIES 5

sasi_v
Tera Guru

Hi @Jessica28 

 

If you are using catalog item variables you can make use of auto populate feature to populate project Id based on project number.

sasi_v_0-1709063320843.png

 This method avoids scripting and it is easy to configure.

 

Regards,

Sasikanth