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

Runjay Patel
Giga Sage

Hi @rmishra4395 ,

 

You can create before business rule like below.

RunjayPatel_0-1732204127590.png

 

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

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

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

 

 

 

But assignment group is mandatory field i cannot save the form without selecting assignment group, so whenever "ABC " agent will create candidate manually at that time assignment group should get autopopulated

This will be taken in in BR. If ABC person create ticket then it will set the value although if user set different cat and sub cat.

 

If you want the same to be work on client side then do the below.

  1. Create on change client script and call script include to check whether user belongs to ABC group or not. If belongs then return true else return false.
  2. In client script set the filed value using g_form.setValue(); if it come true from backend.

Check this link to make ajaxcall from client side: https://servicenowwithrunjay.com/glideajax-in-servicenow/ 

 

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

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

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

 

I have written Script Include 

 

var CheckUserInSMC_NOC = Class.create();
CheckUserInSMC_NOC.prototype = {
initialize: function () {},

isUserInGroup: function (userID) {
// Define the sys_id of the SMC_NOC group
var smcNocGroupSysID = '1412ba851b18b9100f9d43f8ab4bcb41'; // Replace with your SMC_NOC group sys_id
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', smcNocGroupSysID);
gr.addQuery('user', userID);
gr.query();

return gr.hasNext(); // Return true if the user is in the group
},

type: 'CheckUserInSMC_NOC',
};

 

On load client script

function onLoad() {
   var ga = new GlideAjax('CheckUserInSMC_NOC');
    ga.addParam('sysparm_name', 'isUserInGroup'); // Specify the function to call
    ga.addParam('sysparm_userID', gUser.userID); // Pass the current user ID
    ga.getXMLAnswer(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');
        }
 
});
 
   
}


but it's not working