- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 01:03 PM
i have written BR script for it, it is working fine for Existing users,
but when i created one new record in user table then manger name is not reflected based on manager ID number , after created user if i updated any field then it is reflecting manger name.
Thread: My request is here it should reflecting for New records & Existing records
BR Script: Before, inset, update
if(current.u_manager_number=='')
{
current.u_manager= '';
}
else{
var gr=new GlideRecord('sys_user');
gr.addQuery('employee_number',current.u_manager_number);
gr.query();
while(gr.next())
{
current.u_manager=gr.sys_id;
}
}
Manager field is Read only here.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 01:55 PM
Try this script
if (current.u_manager_number!='')
{
var gr=new GlideRecord('sys_user');
gr.addQuery('employee_number',current.u_manager_number);
gr.query();
gs.addInfoMessage('+++++++current.u_manager_number+++++++'+current.u_manager_number);
if(gr.next())
{
gs.addInfoMessage('+++++++current.u_manager_number+++++++'+gr.sys_id);
current.u_manager=gr.sys_id;
}
}
else
{
current.u_manager='';
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 01:06 PM
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 01:14 PM
Hi Sanjiv,
Onchange means here we not changing particular field. so then what based we can use it here.
Can you please suggest me here .
i hope you understand my problem here , i can give more information.
Ex: i am creating new user -JOHN , i have filled all details including Manager Number submitted user form . now it is created as a user record , if we see it now Manager name is not reflected. now if i updated any one of field then immediately manager name was reflected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 01:28 PM
Ok. Can you add a gs.addInfoMessage(current.u_manager_number); after the gr.addQuery script and let me know, if you see the manager number in the message box?
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 01:34 PM