if requested for manager manager is not vip then auto populate in another field in catalog form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 08:26 AM
Hello Experts,
If requested for manager manager is not VIP then auto populate in another field in catalog form in ServiceNow. How we can achieve that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 08:42 AM
Hi @Rajveer ,
You can write onChange client script on "requested for" field and get the manager's manager reference object and can check the VIP status.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 09:07 AM - edited 09-09-2024 09:20 AM
Hi @Rajveer
Write an OnChange Client Script for the Requested for field. This script should use a Glide AJAX call to retrieve data from a Script Include. Based on the response received from the Script Include, the script should determine whether to display or hide a specific field on the form.
Glide AJAX
var ga = new GlideAjax('Script include name');
ga.addParam('sysparm_name', 'getManager');
ga.addParam('sysparm_caller', g_form.getValue('requested_for'));
ga.getXMLAnswer(_handleResponse);
function _handleResponse(answer) {
if(answer)
{
g_form.setDisplay('field name');
}
}
Script Include
getManager: function() {
var userId = this.getParameter('sysparm_caller');
var user = new GlideRecord('sys_user');
if (user.get(userId))
{
var manager = user.getValue('manager VIP field backend name');
Return manager;
}
Thanks,
Eshwar