UI Action on Database View Fails for User (401 Unauthorized + GlideModal Null Errors)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
We have created a custom list UI action that appears on a database view.
It calls a client-callable script include, and also uses the following modals.
- GlideModal: glide_confirm_basic, glide_warn
var confirm = new GlideModal('glide_confirm_basic', true, 500);
confirm.setTitle(getMessage('Confirmation'));
confirm.setPreference('title', '<p>' + getMessage('Do you wish to proceed?') + '</p><br/>');
confirm.setPreference('focusTrap', true);
confirm.setPreference('onPromptComplete', handleFunction);
confirm.setPreference("onPromptCancel", function() {
return false;
});
confirm.render();
var result = new GlideModal('glide_warn', true, 500);
result.setTitle(getMessage('Process Results'));
result.setPreference('title', '<p>' + message + '</p><br/>');
result.setPreference('onPromptComplete', function() {
return false;
});
result.render();
- GlideDialogWindow: dialog_loading
var load = new GlideDialogWindow("dialog_loading", true);
load.setPreference('table', 'loading');
load.setTitle(getMessage('Loading...'));
load.render();
The UI action has the condition: gs.hasRole('admin').
Only the client-callable script include has an ACL; with the role ‘admin’.
But for some reason, when another admin user (with the same roles as ours) clicks the UI action button, the following happens:
- No modal popup
- “Uncaught TypeError: Cannot read properties of null (reading ‘getElementsByTagName’) at GlideModal._renderFromAjax, at klass._responseReceived, at klass._processReqChange” error logged in console
- “POST [instance link] 401 (Unauthorized)” errors logged in console
- “Cannot invoke "com.glide.ui.portal.AbstractRenderer.setPreferences(java.util.HashMap)" because "this.fRenderer" is null: java.lang.NullPointerException” error in system logs
We have tried impersonating this user and the UI action performs as expected with no errors logged. We have also tried testing the UI action using different browsers (Chrome, Mozilla, Edge).
Any suggestions in how to find the cause or resolve this confusing issue will be very much appreciated.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @MarLoi
First, please add this function in your Script Include:
isPublic: function() {
return true;
}
Then test the UI action again to see if it resolves the issue.
If it still doesn’t work, could you please share your Script Include code so that I can try reproducing the issue on my PDI?
Thanks, and regards,
Siddhesh Jadhav
ServiceNow Community Rising Star ⭐ 2025
Please mark this answer helpful and accepted if it resolved your query.