- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 08:44 PM
Hi,
When monitoring team & delivery team members are creating security incident then source should be "phone" by default. it should restrict others to create a source is phone.
EX:
I'm member of monitoring team and I'm creating security incident after click on new button then source should be phone for me and for others it should be none.
Regards,
Sanju
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 10:37 PM
it's showing error, even the part of that particular group and after that I added myself as user from that particular group. then it's working fine but for the existed users it's not working. I'm I created function in right way? why it's showing error like this.
EXISTING USERS:
FOR ME:
CLIENT SCRIPT:
function onLoad() {
var sysid = g_user.userID; //get current user sysid
var ga = new GlideAjax('sn_si.CheckUserGroup'); //script include name
ga.addParam('sysparm_name', 'getgroup'); //function name
ga.addParam('sysparm_name_sysid', sysid); //passing sysid to server
ga.getXMLAnswer(getGroup);
function getGroup(response) {
if (response == 'true') {
g_form.addInfoMessage('Part of group');
g_form.setValue('contact_type','dlp');
g_form.setReadOnly('contact_type',true); // If you want to restrict the field from changing value
} else {
g_form.addInfoMessage(response);
g_form.addInfoMessage('Not Part of group');
g_form.setValue('contact_type', '');//Keep blank
g_form.setReadOnly('contact_type',true); // If you want to restrict the field from changing value
}
}
}
SCRIPT INCLUDE:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2024 10:42 PM
Hi @Talari Balateja ,
Script is taking the login user. Please try after impersonating the user who is present in that group.
Impersonating an user will solve your issue.
Thanks!
Abhishek Dalvi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 08:52 PM
I think you can write before insert BR also you may need to make that field read only and default value as none, Below is the sample BR script:
(function executeRule(current, previous /*null when async*/) {
// Check if the current user is a member of monitoring or delivery team
var currentUser = gs.getUser();
var monitoringTeam = currentUser.isMemberOf('monitoring_team');
var deliveryTeam = currentUser.isMemberOf('delivery_team');
if (monitoringTeam || deliveryTeam) {
// Set source to "phone"
current.source = 'phone';
}
})(current, previous);
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 09:06 PM - edited 04-02-2024 09:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 09:13 PM
Please share your script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 09:17 PM
(function executeRule(current, previous /*null when async*/) {
// Check if the current user is a member of monitoring or delivery team
var currentUser = gs.getUser();
var monitoringTeam = currentUser.isMemberOf('Phone Monitoring Team');
var deliveryTeam = currentUser.isMemberOf('Secure Delivery Team');
if (monitoringTeam || deliveryTeam) {
// Set source to "phone"
current.contact_type = 'phone';
}
})(current, previous);