- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2026 05:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2026 05:59 AM
Hi @damodar
It is dot walk.
alm_hardware table --.Assigned to field is there
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2026 06:19 AM
you will require onChange client script on Employee name reference field and bring the hardward assigned to that person and then set it
Something like this with GlideAjax
Script Include: it should be client callable
var GetUserHardwareAjax = Class.create();
GetUserHardwareAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getHardwareByUser: function() {
var userSysId = this.getParameter('sysparm_user_sys_id');
var hardwareRecord = new GlideRecord('alm_hardware');
hardwareRecord.addQuery('assigned_to', userSysId);
hardwareRecord.query();
if (hardwareRecord.next()) {
return hardwareRecord.getUniqueValue();
}
return '';
},
type: 'GetUserHardwareAjax'
});
Client Script: onChange of employee
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
if (newValue == '') {
g_form.clearValue('u_hardware'); // give here the correct field name
}
if (oldValue != newValue) {
var ga = new GlideAjax('GetUserHardwareAjax');
ga.addParam('sysparm_name', 'getHardwareByUser');
ga.addParam('sysparm_user_sys_id', newValue);
ga.getXMLAnswer(function(answer) {
if (answer != '')
g_form.setValue('u_hardware', answer); // give here the correct field name
else {
g_form.addInfoMessage('No hardware assigned to this user');
}
});
}
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2026 08:02 AM
Hi @damodar
Try this (high level design) :
- Employee Name
- Type: Reference
- Reference Table: sys_user
- Reference qual condition: active=true^u_workday_integration=true
- Employee ID
- Type: String (Read-only)
- How to Populate:
- Set the Dependent question to the "Employee Name" field, and set the Dot walk path to employee_number /the field where you stored employee number (refer: Auto-populate a variable based on a reference type variable (Utah))
- Create an onChange Client Script on the Employee Name field using g_form.getReference() to fetch and set the value .Refer : https://www.servicenow.com/community/itsm-forum/auto-populate-fields-from-selected-user/m-p/604446
- Computer Name
- Type: Reference or String (Read-only)
- Reference Table: alm_hardware
- How to Populate:
- For Standard Forms: Create an onChange Client Script that triggers off the Employee Name field, pulling the primary computer field via a GlideAjax / getReference call.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2026 07:46 PM
Thank you for marking my response as helpful.
Do you require any further help? Do let me know.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2026 05:59 AM
Hi @damodar
It is dot walk.
alm_hardware table --.Assigned to field is there
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2026 06:19 AM
you will require onChange client script on Employee name reference field and bring the hardward assigned to that person and then set it
Something like this with GlideAjax
Script Include: it should be client callable
var GetUserHardwareAjax = Class.create();
GetUserHardwareAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getHardwareByUser: function() {
var userSysId = this.getParameter('sysparm_user_sys_id');
var hardwareRecord = new GlideRecord('alm_hardware');
hardwareRecord.addQuery('assigned_to', userSysId);
hardwareRecord.query();
if (hardwareRecord.next()) {
return hardwareRecord.getUniqueValue();
}
return '';
},
type: 'GetUserHardwareAjax'
});
Client Script: onChange of employee
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
if (newValue == '') {
g_form.clearValue('u_hardware'); // give here the correct field name
}
if (oldValue != newValue) {
var ga = new GlideAjax('GetUserHardwareAjax');
ga.addParam('sysparm_name', 'getHardwareByUser');
ga.addParam('sysparm_user_sys_id', newValue);
ga.getXMLAnswer(function(answer) {
if (answer != '')
g_form.setValue('u_hardware', answer); // give here the correct field name
else {
g_form.addInfoMessage('No hardware assigned to this user');
}
});
}
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2026 07:46 PM
Thank you for marking my response as helpful.
Do you require any further help? Do let me know.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2026 08:02 AM
Hi @damodar
Try this (high level design) :
- Employee Name
- Type: Reference
- Reference Table: sys_user
- Reference qual condition: active=true^u_workday_integration=true
- Employee ID
- Type: String (Read-only)
- How to Populate:
- Set the Dependent question to the "Employee Name" field, and set the Dot walk path to employee_number /the field where you stored employee number (refer: Auto-populate a variable based on a reference type variable (Utah))
- Create an onChange Client Script on the Employee Name field using g_form.getReference() to fetch and set the value .Refer : https://www.servicenow.com/community/itsm-forum/auto-populate-fields-from-selected-user/m-p/604446
- Computer Name
- Type: Reference or String (Read-only)
- Reference Table: alm_hardware
- How to Populate:
- For Standard Forms: Create an onChange Client Script that triggers off the Employee Name field, pulling the primary computer field via a GlideAjax / getReference call.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti