- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 10:09 PM
Hi Community,
When logging in to the portal as an external user and displaying the catalog item screen, the script include function cannot be called from the onLoad script that is executed.
However, if you view the relevant screen from the portal as admin user, the script include function will be executed correctly.
What is the cause of the Script Include function call not working when the screen is displayed as an external user?
I'm new to ServiceNow and JavaScript, so I expect easy-to-understand comments.
Thanks in advance,
**** Web browser Console ( execute by external user ) ****
**** Web browser Console ( execute by admin user ) ****
***** Extenal user *****
***** admin user *****
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 10:50 PM
if it's snc_external user then add this function isPublic in your script include and it will be able to call
var CmnUtil = Class.create();
CmnUtil.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
logtest: function() {
var str = this.getParameter(sysparm_foo);
gs.info('**** CmnUtil - logtest *****' + str);
return "logtest success!!!!";
},
isPublic: function() {
return true;
},
type: 'CmnUtil'
});
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 10:16 PM
Hey @Suyong,
Check the ACL's on the script include. See whether it includes snc_external role to it.
If my answer has helped you in any way please mark it as correct or helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 07:58 PM
Thank you for your response!
I solved the problem by setting the Requires role correctly in the ACL of the script include
Thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2025 10:50 PM
if it's snc_external user then add this function isPublic in your script include and it will be able to call
var CmnUtil = Class.create();
CmnUtil.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
logtest: function() {
var str = this.getParameter(sysparm_foo);
gs.info('**** CmnUtil - logtest *****' + str);
return "logtest success!!!!";
},
isPublic: function() {
return true;
},
type: 'CmnUtil'
});
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 08:02 PM
Thanks for the response!
I see, you check the accessibility of the script include in the function - isPublic.
I will refer to it!
Regards