Hi, can you pls help me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2025 10:42 AM
This question was asked in an interview :
we have a catalog form, where we have employee, email, company fields so, when employee field is something then email and company fields should auto populate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2025 08:09 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2025 03:31 AM
People keep answering with scripting solutions, while the auto-populate has been around for a while. Please use that, as it is an OOB, no code solution, easily added through the form itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2025 05:24 AM
Hi @sheddyshiri ,
For this scenario there are two main approaches:
OOB Auto-populate (Recommended): If Employee is a reference to sys_user, you can use the Auto populate tab on the Email and Company variables. This will automatically pull the values from the user record without scripting.
Scripting Option: If you need more flexibility, you can add an onChange catalog client script on Employee and use getReference() (or GlideAjax + Script Include) to fetch email and company, then set those values.
OOB auto-populate is cleaner and easier to maintain, while scripting is useful if you need custom logic.
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2025 05:47 AM
Hi @sheddyshiri ,
The best to use OOTB 'auto populate' option for email and company field as they both available in User [sys_user] table.
Create Simple Text type field for Email and Company and use dot walk path for email and company value respectively.
-Thanks,
AshishKM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2025 06:14 AM
Hi @sheddyshiri
You can achieve this by using a Catalog Client Script with onChange on the Employee field.
When the user selects an employee, use a GlideAjax / g_form.getReference() call to fetch the related details.
Then set the values of Email and Company automatically with g_form.setValue().
example script-function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}g_form.getReference('employee', function(emp) {
if (emp) {
g_form.setValue('email', emp.email);
g_form.setValue('company', emp.company.name);
}
});
}
If I answered your question please mark (Correct ) to my answer.
Thanks you ,
Pranita D