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

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

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.

Thank you for helping @SanjivMeher 

This is a Catalog item.  The project id is Lookup Select Box type.  When the form load, can we clear the value in the project id field?  Is it possible to set it in reference qualifier or variable attributes.  Thanks

 

Jessica28_0-1709061094268.png

 

In the Lookup Select Box, can you make include none checked, so that it doesn't default to a value.

SanjivMeher_0-1709061861786.png

 


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