The CreatorCon Call for Content is officially open! Get started here.

Polpulate lookup select box variable based on another lookup select box variable

Vivek13
Tera Contributor

Hi please help me with the following:

I have 2 lookup select box variable both has lookup from table as sys_user. One for lookup value field Email and another for  lookup value field Employee number. I want to set the value of Employee number variable based on the email chosen.
find_real_file.png

find_real_file.png

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Hi Vivek,

 

Yes, Tested the same & it seems getReference would not work as its look-up reference field.

I suggest you to 

1. Mark the script -False

2. Only use reference qualifier as below.

javascript: 'email='+current.variables.email;

Tested the same & it works.

 

View solution in original post

7 REPLIES 7

Jaspal Singh
Mega Patron
Mega Patron

Hi Vivek,

 

For the Employee number look-up can you try using below as reference qualifier

javascript: 'email='+current.variables.email;

 

Additionally, you can use an onChange() client script that runs when Email variable field changes.

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var emailis = g_form.getReference('email', empnois);

    function empnois(emailis) {
        g_form.setValue('employee_id', emailis.employee_number);
    }

}

Hi,

I have tried both, but its not setting the employee id and still its showing all the employee numbers in the drop down.

find_real_file.png

find_real_file.png

Hi Vivek,

 

There is a typo in your script.

Line 8 should be emp.employee_number & not emailis.employee_number

 

Also, if you are using script then you need not use the reference qualifier.

Hi,

Yes I have changed it, but still the same