how to validate user group member in the script include
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 11:01 AM
Hi All,
we have a on call support, in the below script we are getting first on call of assignment group person, if user is not available we are using the CI record SME , so i want to check that SME is also is part of the assignment group or not, if not want to field return empty.
please help me with code , how to achieve this
getAssignee: function(cmdbCiId, groupId) {
//this function gets the First On Call for the Assignment group and passes it to the client script
var ciID = cmdbCiId || this.getParameter('sysparm_ci');
var group = groupId || this.getParameter('sysparm_group') + '';
// Look for the group's first on-call
gs.include("OnCallRotation");
var rota = new OnCallRotation();
rota.who(group);
// return primary rota user if available
if (rota.getPrimaryUser() && rota.getPrimaryUser() != null) {
return rota.getPrimaryUser();
}
// return primary sme if available
var ciGR = new GlideRecord('cmdb_ci');
// If we can read the CI record, then get the SME
if (ciGR.get(ciID) && ciGR.u_primary_sme) {
return ciGR.u_primary_sme;
}
return 'none defined';
},
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 01:02 PM
Where exactly are you having trouble? What part of your script is not working?
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/