- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2025 05:53 AM
Hi Everyone,
I have created a UI Script in Custom Scope 'A' and I want to call this script into UI Action which is present in custom scope B.
Is it Possible for me to call cross scope UI script into UI Action.
UI Script:
functionsUIscriptHelpers();
function functionsUIscriptHelpers() {
function helper1() {
alert("TEST helper1 FUNC")
}
functionsUIscriptHelpers.functionsUIscriptHelpers = helper1;
}
UI Action:
function onClickOfUIAction() {
functionsUIscriptHelpers.helper1();
}
I cannot see the Alert message. Please guide how can I call cross scope UI Script into UI Action. And I want to know, can I send some variables also into this UI script.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2025 09:05 AM
It works, you should be able to call UI script created in scope A from any outside scope
UI Script: Created in scope "01/23"
Called that UI Script from Client script in other scope "16Jan 001"
Output: It called that function and gave alert when onload form was opened for My Table present in scope "16Jan 001"
I hope I have answered your question.
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
05-26-2025 08:54 AM
you should find lot of OOTB UI scripts used in scoped app, you can check them
But I am not sure if cross scope UI script is allowed and if it works
search with client script contains ScriptLoader
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
05-26-2025 09:05 AM
It works, you should be able to call UI script created in scope A from any outside scope
UI Script: Created in scope "01/23"
Called that UI Script from Client script in other scope "16Jan 001"
Output: It called that function and gave alert when onload form was opened for My Table present in scope "16Jan 001"
I hope I have answered your question.
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
05-26-2025 08:13 PM
Hope you are doing good.
Did my reply answer your question?
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
05-26-2025 09:47 PM - edited 05-26-2025 09:54 PM
Hi @Ankur Bawiskar ,
I used exact code used by you, but in place of client script I am using UI Action. I cannot see alert. Is it like I can call UI script in another scope from client script but not from UI Action.
And in console I am getting this error:
Refused to execute script from 'https://ven04333.service-now.com/x_cc_aa_spoke.MyScriptDesktop' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2025 10:11 PM
Please check the configurations once.
It worked for me when called from UI action
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