How do I make a dependent field on the same table?

CCSF-Syd
Tera Expert

Background:

 

  • 1 Table: cmn_department
  • 1 Column: parent
  • 2 Logical objects:
    • Department: cmn_department row where Level == 1
    • Division: cmn_department row where Level > 1 and Parent is a circular reference to cmn_department where Level == 1

I would like a Division field to only show values based on the Department selected - they are both records on the same table cmn_department and use the Parent field as a reference.

 

Please see the attached screenshot of what I would like: when you choose Department A, in the Division dropdown, you see every Department with Department A in the Parent field.

2 REPLIES 2

CCSF-Syd
Tera Expert

It looks like a reference qualifier of "javascript:'u_top_level_department='+current.department" accomplished what I need.

Abhishek Pal
Tera Contributor

You can achieve this using an Advanced Reference Qualifier on the Division field.

On the Division reference field, add this Reference Qualifier:

javascript:'parent=' + current.u_department

Replace u_department with your actual Department field name.

Also create an onChange Client Script on the Department field to clear the Division value when Department changes:

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;
g_form.clearValue('u_division');
}

Replace u_division with your actual Division field name.