
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:24 AM
Hi,
I've a catalog Item, where there is field called Caller which is a reference field to User table which is auto populate. I've created another text field besides that which should automatically reflect corresponding Department of the caller field.
And again, if I change the caller field, then automatically Department field should be changed.
FYI - Department is a reference field in user table.
For Example, my name is Bijay Kumar Sharma and if I open my Profile, then there is a reference field called 'Department'. If I open that department record, I'm seeing it's in 'cmn_department' table where there are different fields such as Name, ID, Description, Department Head etc
How to implement this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:30 AM - edited 01-18-2024 04:31 AM
Hi,
Please check below links:
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:30 AM - edited 01-18-2024 04:31 AM
Hi,
Please check below links:
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:36 AM
Plz try to Glide Ajax to call a script include then return the user values as needed.
Create a script inclde get the data makesure Client callable is true.
var loaner = Class.create();
loaner.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getdpt: function() {
var obj = {};
var sysid = this.getParameter('sysparm_usrsysid');
var grusr = new GlideRecord("sys_user");
grusr.addQuery('sys_id', sysid);
grusr.query();
if (grusr.next()) {
obj.department = grusr.getValue('department');
}
return JSON.stringify(obj);
},
type: 'loaner'
});
On change client script:-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var name = g_form.getValue('requested_for');
var user = new GlideAjax('global.loaner');
user.addParam('sysparm_name', 'getdpt');
user.addParam('sysparm_usrsysid', name);
user.getXML(getData);
}
function getData(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
var data = JSON.parse(answer);
g_form.setValue('department', data.department);
}
Please mark reply as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:36 AM
Use Auto populate on variable and by dot walk it will work for you.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
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
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:38 AM
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
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
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************