Populating Catalog Fields Based on Another Field

Wasdom_Kung
Tera Guru

Hello,

I currently have 3 fields on an item:

1. Code search

2. Tray ID

3. Tray Name

I also have a custom table with 3 columns (u_nhsl_tray_codes_choices).

The user will select a code from 'code search', this code will have a tray id and tray name associated with it - I want to populated field 2 and field 3 with the corresponding column values, this way the user will see their selected code, ID and name across the 3 variables.

find_real_file.png

How can I achieve this?

1 ACCEPTED SOLUTION

Wasdom_Kung
Tera Guru

I've managed to fix this using the following  'onChange' script, and turning the 2 and 3 variables into single line texts.

function onChange(control, oldValue, newValue, isLoading) {}

var trayTable = g_form.getReference('u_rmd_and_tray_search', populateTrayID);

function populateTrayID(trayTable) {

    g_form.setValue('u_tray_id_readonly', trayTable.u_tray_id);
	g_form.setValue('u_tray_name_readonly', trayTable.u_tray_name);
}

 

View solution in original post

12 REPLIES 12

Originally, is that still the requirement or changed?

How are you certain that other 2 fields will lead to 1 single record only?

-Anurag

So in this example, RMD A000456 has a Tray ID value and a Tray name value, I just want those to display to the user.

Tray ID and Tray name will be read-only values.

 

Some RMD values have multiple entries, so A00000 might have ID 100 and name 200, and another might have ID 200, and name 300. It is only for display purposes, so as long as the RMD is selected, it should just pull the other two values for display

 

Wasdom_Kung
Tera Guru

I've managed to fix this using the following  'onChange' script, and turning the 2 and 3 variables into single line texts.

function onChange(control, oldValue, newValue, isLoading) {}

var trayTable = g_form.getReference('u_rmd_and_tray_search', populateTrayID);

function populateTrayID(trayTable) {

    g_form.setValue('u_tray_id_readonly', trayTable.u_tray_id);
	g_form.setValue('u_tray_name_readonly', trayTable.u_tray_name);
}