Wanted to show the reference field values based on select box

CDJ
Tera Contributor

Hi All,

Need suggestions on below requirement

1. Wanted to show the reference field values "Employee name" reference table is sys_user.

2. Based on select box "Hire Type"  with options "Contractor and Employee" so the requirement is if user selects Contractor hire type then in employee name field it should show only contractor users orelse employee users

 

In user table  there is a "contractor" checkbox if its checked those are contractor users if its unchecked those users are employee

 

Thanks in advance!

1 ACCEPTED SOLUTION

If you always want only active users, add it to the beginning:

javascript:
  var ret = 'active=true^u_is_contractor=';
     if (current.variables.u_z_onboarding_hire_type == 'contractor') {
    ret += 'true';
    } else {
    ret += 'false';
  }

View solution in original post

6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

You can use a reference qualifier like this:

javascriptt:var ret='u_contractor='; if(current.u_hire_type=='Contractor'){ ret += 'true';} else {ret+='false'};

With only one t in javascript, where u_contractor is the field name on the sys_user table, u_hire_type is the select box field name, and 'Contractor' is the select box choice value. 

Hi @Brad Bowman  ,

 

Thank you so much for your response!

 

I've tried this qualifier script but When I select Hire type as "Contractor" all users are showing except contractor users . Could you please guide me on this.

 

Thanks in advance!

Hi @Brad Bowman  ,

 

I've tried this qualifier script but when I select Hire type as "Contractor"its showing all users except contractor users.

Could you please guide me on this.

 

Thanks in advance!

That likely means the if statement is not being met.  Did you replace 'u_hire_type' and 'Contractor' to match the field name and value (not Label) of your Choice record?  Is the reference and select box a field on a table form, or a variable on a Catalog Item?  If it's the latter you would use current.variables.u_hire_type to refer to the select box variable, but everything else should be the same.