Field on record producer populating based on the another field on the form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 02:21 PM
Hi there,
I have a field on the form "Employee Leaving". I want to populate another field "Who should the direct report be assigned to" if this Employee Leaving is a manager. Can someone help with the client script and script include.
Basically, we need to check if the user selected on the employee leaving field is a manager of any other user and if he is then populate the field ""Who should the direct report be assigned to" else don't populate the field on the form
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2023 06:31 PM
you can use onChange client script + GlideAjax to check if the selected user is manager and not
What did you start with?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 10:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 10:00 PM
Did you check what came in alert for the response?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 12:10 PM
Hi @Simran321 ,
Hope you are doing great.
I have gone through your script, script include will be returning boollean value as true or false from function as hasNext() Function return boolean value. If your logic is returning correct value then try to use below modification in client script code :
- In callback function defines , where you are checking the condition response == 'false' is incorrect as per me as you are trying to compare the boolean value with string value as "false". Try to use below part while comparing repsponse ;
if (response == false ){
//logic - set value to true
}
else{
//logic - set value to false
}
Regards,
Riya Verma