- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 10:48 PM
Hi Community,
I have a widget which contains a reopen button inside it.
I want to show an error msg when user clicks on that button when its assigned to xyz group. I want to restrict that action when its assigned to this group.
Here is the server script for that.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 11:37 PM
Hi @Poorva Bhawsar ,
You can use the below script:
if (input && input.action == 'reopenIncident' && incidentGr.get(incidentSysId)) {
if (incidentGr.assignment_group.getDisplayValue() ==="Assignment Group Name") { // replace with actual group name
gs.addErrorMessage('Incident cannot be reopened as its assigned to command centre');
}else {
incidentGr.incident_state = global.IncidentState.IN_PROGRESS;
incidentGr.state = global.IncidentState.IN_PROGRESS;
incidentGr.comments = "Reason for rejection: " + input.rejectReason; //Line added for fixing INC3257360
data.isIncidentReopened = incidentGr.update();
gs.addInfoMessage(gs.getMessage("Request reopened"));
}
}
You can replace 'Assignment Group Name' with actual group name in line 2
Please mark as Accepted Solution & hit helpful !!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 11:03 PM
Hi @Poorva Bhawsar ,
Does your widget contain a list of incidents and each incident have a reopen button beside it?
If that's the case then, you will need to write a function inside "client controller" which will get called "on-click" of reopen button, pass the incident "sys_id" from that function to server side and then show error message just for that incident by checking assignment group condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 11:21 PM
This is what currently i have in my client controller for reopen button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 11:37 PM
Hi @Poorva Bhawsar ,
You can use the below script:
if (input && input.action == 'reopenIncident' && incidentGr.get(incidentSysId)) {
if (incidentGr.assignment_group.getDisplayValue() ==="Assignment Group Name") { // replace with actual group name
gs.addErrorMessage('Incident cannot be reopened as its assigned to command centre');
}else {
incidentGr.incident_state = global.IncidentState.IN_PROGRESS;
incidentGr.state = global.IncidentState.IN_PROGRESS;
incidentGr.comments = "Reason for rejection: " + input.rejectReason; //Line added for fixing INC3257360
data.isIncidentReopened = incidentGr.update();
gs.addInfoMessage(gs.getMessage("Request reopened"));
}
}
You can replace 'Assignment Group Name' with actual group name in line 2
Please mark as Accepted Solution & hit helpful !!!