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

Hi,

Yeah it's a reference, I've also set Tray ID and Tray name to reference fields also, although I've realised that the display value for the table is the same as whatever is in u_rmd_and_tray_search so maybe that is why it won't display the other fields?

Edit: I've changed to SYS_ID but nothing is populating

 find_real_file.png

Hi,

u_rmd_and_tray_search  refers to which table?

It should be u_nhsl_tray_codes_choices.

Can you share any one of record screenshot?

Thanks,
Murthy

So:

find_real_file.png

u_rmd_and_tray_search references the table u_nhsl_tray_codes_choices which has the 3 columns I want the values from (TRAY ID, TRAY Name, TRAY TYPE ID).

find_real_file.png

  • RMD and tray search (References above table) displays TRAY Type ID.
  • Tray ID (References above table) should display associated TRAY ID with the selected TRAY ID.
  • Tray name (References above table) should display associated TRAY NAME with the selected TRAY ID.

find_real_file.png

I hope that makes more sense.

 

 

Anurag Tripathi
Mega Patron
Mega Patron

Is column 1 reference field?

If i understand correctly, all you need is to fetch couple fie fields from column 1 record and populate it on the firm. Is that right?

-Anurag

Yeah it's a reference field.

I was originally trying to populate the ID and Name field based on the two remaining column values.

So RMD is column 1, Tray ID is column 2 and Tray name is column 3.

find_real_file.png