Set Category and Subcategory for MIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 07:28 AM
Hello Team,
Need Help.
Whenever Proposed Major Incident is created by "ABC" group member then set Category as Remote and Subcategory as "Unknown" and Assignment group as "XYZ" group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 08:26 AM
Hi @rmishra4395 ,
Couple of error in your script.
use below script in script include.
var CheckUserInSMC_NOC = Class.create();
CheckUserInSMC_NOC.prototype = {
isUserInGroup: function () {
var smcNocGroupSysID = '1412ba851b18b9100f9d43f8ab4bcb41'; // Replace with your SMC_NOC group sys_id
return gs.getUser().isMemberOf(smcNocGroupSysID); // Return true if the user is in the group
},
type: 'CheckUserInSMC_NOC',
};
Client side code:
function onLoad() {
var ga = new GlideAjax('CheckUserInSMC_NOC');
ga.addParam('sysparm_name', 'isUserInGroup'); // Specify the function to call
ga.getXML(function (response) {
var isMember = response.responseXML.documentElement.getAttribute('answer');
if (isMember == 'true') {
// Set the Assignment Group to SMC_NOC
gForm.setValue('assignment_group', '1412ba851b18b9100f9d43f8ab4bcb41');
g_form.setValue('category','1');
g_form.setValue('subcategory','7');
}
});
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 08:36 AM
This also did not work. I impersonated an SMC_NOC agent and tried creating a candidate manually, but the fields did not auto-populate when the form loaded.