gs.addInfoMessage not showing up on (government Service) Portal in Before Insert BR on attachment.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 10:15 PM
This is my code -
As an admin, while on playbook experience on Portal, I can see the addInfoMessage instantly, when needed. But as a constituent, non SNC Internal role, on portal the mesage does not show up instantly, it shows up when the window is refreshed. Below is my code.
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var MAX_SIZE = 10490314;
var mimeTypeArray = [];
var propertyValue = gs.getProperty('attachment.allowed');
if (propertyValue) {
// Split the property value by commas and push it to an array
mimeTypeArray = propertyValue.split(',').map(function(mimeType) {
return mimeType.trim(); // Trim spaces around each MIME type
});
}
var val = mimeTypeArray.indexOf(current.getValue('content_type'));
if (val == -1) {
gs.addInfoMessage("infoMsg");
current.setAbortAction(true);
gs.setRedirect(current);
}
if (current.size_bytes > MAX_SIZE) {
gs.addErrorMessage('File size exceeds the maximum allowed size of 10MB.');
current.setAbortAction(true);
}
})(current, previous);
I have also tried removing and adding 'gs.setRedirect(current);' in the if, but it makes no difference.
Labels:
- Labels:
-
Customer Service Management
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 10:56 PM
not very sure, please raise a case with ServiceNow.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader