Get Department from Selected User in Reference Variable on the catalog

gjz
Mega Sage

I have two reference variables on a catalog item, one for the user and the other for the user's department.  I've looked at several other posts, all with the same solution but for some reason it isn't working for me.  Can someone help, please?

Variables:

find_real_file.png

User reference variable (variable is requested_for):

find_real_file.png

Department reference variable:

find_real_file.png

1 ACCEPTED SOLUTION

Thanks - the onChange client script was what I needed.

View solution in original post

5 REPLIES 5

OlaN
Giga Sage
Giga Sage

Hi,

What are you trying to do?

Since you have selected a user as a reference variable, you know the department that user belongs to.

Why do you need a second variable for the department?

Hi,

I just realized I didn't finish adding requirements.

I want the user's department to fill in automatically when the user is selected because we need the department as a separate variable for the Orchestration workflow.

I created a separate variable to satisfy orchestration, but I don't want the user to have to fill in their department.

Ah, I see. If you need it to fill the department automatically, you will need to write an onChange client script, that runs when you set the "user" variable.

You will need to perform a AJAX call, to get the value from the server side.

If you are ok with manually selecting the department, and query from the selected user, then change your reference qualifier to:

javascript: 'sys_id =' + current.variables.user.department;

Where "user" is the name of the user-variable on your form.

Thanks - the onChange client script was what I needed.