Auto populate field from a reference field on a catalog item variable

riskay123
Mega Guru

I have a variable that contains a reference field that references the sys_user table.

I have added another two fields for Email and Department and I would like to have them auto populate with the related information for the selected user in the Requested for field.

 

How can I do this please?

 

Image 1.JPG

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

You need a onChange client script for the same as below

 

var caller = g_form.getReference('requested_for', popCallerInfo);

function popCallerInfo(caller){
         g_form.setValue('<user email variable name>', caller.email);

g_form.setValue('<department variable name>', caller.department);

}


Please mark this response as correct or helpful if it assisted you with your question.

Hi Sanjiv,

 

Thanks for your quick reply. I have added a client script as you suggested.

Image 1.JPG

I think I have missed a step. How do I make the User email and Department fields display the email address and department. When I click on the drop down the User Name is displayed.

 

Image3.JPG

I am assuming I need to add something to the Type Specifications or the Default Value on the two variables. Below is an example of the User Email variable.

Image2.JPG

Murthy Ch
Giga Sage

Hi @riskay123 

We cannot display the email address only because for the user table, Name is the display field means if we refer to user table it will display the name by default and we cannot change it. 

 

Thanks,
Murthy

So is there is no way to get the email and department information on the form then?