Need to show an error message only on the classic UI but should not appear on the Service portal sid
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2025 10:51 AM
Hi,
I have a requirement to display the error message if the assignment group is empty only on the classic UI but to hide it on the Service Portal.
Will the below logic work?
if (gs.isInteractive() && gs.getSession().getStackName() !== 'Service Portal') {
gs.addErrorMessage('There is no assignment group');
current.setAbortAction(true);
}
10 REPLIES 10
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2025 12:10 AM
Hi Ankur,
Below script is working for me now,
if (GlideTransaction.get().getRequest().getHeader("referer").indexOf('/sp') > -1) {
gs.addInfoMessage('This is portal UI');
} else {
gs.addErrorMessage("Assignment group cannot be empty when submitting from this interface");
current.setAbortAction(true);
}