- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2023 10:52 PM
Hi All,
Can anyone please help me with a client script ?
Requirement :
If user select assignment group in incident then show alert message, alert message should have the name of the assignment group manager and assignment group name.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 10:58 AM
@jayaprakash1998 Here is how you should configure an onChange client script on your incident form.
Here is the script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var assignment_group = g_form.getReference('assignment_group',callback);
function callback(group){
g_form.setValue('assigned_to',group.manager);
var manager = g_form.getReference('assigned_to',anotherFunc);
function anotherFunc(caller){
alert('Group Name: '+group.name + ' Group Manager: '+caller.name);
g_form.clearValue('assigned_to');
}
}
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 05:03 AM
Greetings!!
What error your are facing? Asking to script is not good, if you wrote your script and its not working , please share the script to support you.
Check this link:
Or check this playlist:
https://www.youtube.com/playlist?list=PLi0Ik1xCDEbK5BJme5YSGZASvl0nkaFHn
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
10-30-2023 08:01 AM
Hi @Dr Atul G- LNG Thankyou
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 09:30 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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2023 05:23 AM
Hi Jaya,
I agree with Atulya. But just to help you with the approach you can either use an asynchronous calling to the server to get manager value of assignment group or you can do a synchronous calling.
Example of asynchronous calling to server using (g_form.getReference(formula)):
g_form.getReference('requested_by',userLookup); //userLookup is a self invoking function
function userLookup(userRef){ //Function called with parameter
alert(userRef.email);
}
Synchronous calling to server includes creating a script include and then calling it in Client script using GlideAjax. I would recommend doing it only when you're getting a good amount of data which may take sometime.
For your use case you should use getReference and modify the script above according to your need in Client Script.
If my answer helps then please mark it Helpful or Correct!
Thanks,
Utpal