Reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-11-2023 02:37 AM
what reference should I use in a variable "Requested For's Manager" That is Auto-populated with Requested For's Manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-11-2023 03:32 AM
Hi @aniellacerna ,
I believe you are trying to auto-populate the Requested for's manager when Requested for is selected.
In order to achieve this, you can try the below:
The type of field for 'Requested For's Manager' will be reference and then write a 'onChange' catalog client script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reqForUser = g_form.getReference('requested_for', getMgr);
function getMgr(reqForUser) {
g_form.setValue('manager', reqForUser.manager);
}
}
Please accept my answer and mark this helpful if it helps.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-11-2023 04:47 AM - edited ā11-11-2023 06:38 AM
Hi @aniellacerna ,
You can try the Auto-populate feature in servicenow.No need for any scripting.
Open the requested for manager field there u should be able to find the Auto-populate tab. Just fill it like below.
For additional info plz go through the below link:
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-11-2023 06:35 AM
Hi there are two ways to do first with client script and script include
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reqFor = g_form.getReference('requested_for', Mgr);
function Mgr(reqFor) {
g_form.setValue('manager', reqFor.manager);
}
}
and for script include watch below video
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-13-2023 02:24 AM
If you creating a new field for Manager Approval - Please user user table for reference.
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]
****************************************************************************************************************