- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2022 01:31 AM
Hi All,
I am writing OnChange Client Script to populate field from cmdb_ci table on incident form in custom field using getReference and Callback method.. This works fine on the Platform UI but doesn't show up any value of Agent Workspace.
Code:
var solution_provider;
var ref2=g_form.getReference('cmdb_ci',callBack2);
function callBack2(ref2){
var asset2 = ref2.support_group;
var grp = new GlideRecord('sys_user_group');
grp.addQuery('sys_id', asset2);
grp.query();
if (grp.next()) {
solution_provider = grp.name;
}
g_form.setValue('u_solution_provider', solution_provider);
}
Could there be problem of GlideRecord statement or something like that? I have other scripts which do not need GlideRecord call and they works fine for both platform UI and Agent workspace..
Any suggestions ?
Thanks in advance
Solved! Go to Solution.
- Labels:
-
Agent Workspace
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2022 02:32 AM
Hi,
Don't use GlideRecord in client side.
Why not use GlideAjax?
OR
try to use GlideRecord with callback and check once
var solution_provider;
var ref2 = g_form.getReference('cmdb_ci',callBack2);
function callBack2(ref2){
var asset2 = ref2.support_group;
var grp = new GlideRecord('sys_user_group');
grp.addQuery('sys_id', asset2);
grp.query(checkRecord);
function checkRecord(grp){
if(grp.next()){
var solution_provider = grp.name;
g_form.setValue('u_solution_provider', solution_provider);
}
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2022 02:32 AM
Hi,
Don't use GlideRecord in client side.
Why not use GlideAjax?
OR
try to use GlideRecord with callback and check once
var solution_provider;
var ref2 = g_form.getReference('cmdb_ci',callBack2);
function callBack2(ref2){
var asset2 = ref2.support_group;
var grp = new GlideRecord('sys_user_group');
grp.addQuery('sys_id', asset2);
grp.query(checkRecord);
function checkRecord(grp){
if(grp.next()){
var solution_provider = grp.name;
g_form.setValue('u_solution_provider', solution_provider);
}
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader