Set Category and Subcategory for MIM

rmishra4395
Tera Contributor

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.

6 REPLIES 6

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

-------------------------------------------------------------------------

 

In this video i have explained about Web service integration in ServiceNow like how it works, how we can configure it, what are the prerequisite and many more. I have covered below topics in this video. 1. understand Web Service. Like when and how we will use it. 2. Talked about Inbound and ...


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.