Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to pull the job title based on entry on a user lookup field?

James Rostron1
Tera Expert

Hi Community,

I'm looking for a way to auto-populate the Job Title and Initials (user_id) when the selection of the "employee transferring" is completed. All the information is contain in the user record already i just need a way of it pulling the information from there into the field.

E.g. in the example below, employee is Aaron Allen, how can i set the Job Title and Initials to pull in their user record details.

The field names on the sys_user table are below:

Job Title = title
Initials = user_id

I know how to do this for the current logged in user of the Portal but what if selection is not the current logged in user e.g. submission on behalf of a colleague.

find_real_file.png

Many thanks,

James

1 ACCEPTED SOLUTION

VigneshMC
Mega Sage

Write an onchange catalog client script on employee transferring field.

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

  var user = g_form.getReference('<field_name_of_employee_transfer>', doAlert); // doAlert is our callback function
}
function doAlert(user) { //reference is passed into callback as first arguments
	g_form.setValue('<field_name_of_employee_inital>',user.user_id);
        g_form.setValue('<field_name_of_employee_title>',user.title);
}
   

Thanks

View solution in original post

2 REPLIES 2

VigneshMC
Mega Sage

Write an onchange catalog client script on employee transferring field.

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }

  var user = g_form.getReference('<field_name_of_employee_transfer>', doAlert); // doAlert is our callback function
}
function doAlert(user) { //reference is passed into callback as first arguments
	g_form.setValue('<field_name_of_employee_inital>',user.user_id);
        g_form.setValue('<field_name_of_employee_title>',user.title);
}
   

Thanks

Thank you that works a treat!!! :)))))