- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello team,
I am trying to filter out the company in company table which are used in "Business Application" table .
I have created script include which is in different scope than global scope and accessible from is "This application scope only"
Script :--
function GetCompany() {
var companies = [];
var ga = new GlideAggregate('cmdb_ci_business_app');
ga.addNotNullQuery('company');
ga.groupBy('company');
ga.query();
while (ga.next()) {
companies.push(ga.getValue('company').toString());
}
return companies.join(',');
}
.................................................................
And on company table filter is :--sysid is one of javascript:GetCompany()
when i run the filter it becomes sysid in NULL.
NOTE:-- I have checked sandbox enabled.
thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
for existing one it won't allow
please create new and then set it and use that
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hey!
The main issue is the scope. Your Script Include is in a scoped application, but the Company list filter is running from the Global scope.
The simplest fix is to change the Script Include Accessible from to All application scopes and make sure the Script Include is client-callable only if you actually need it from the client side. If Accessible from is stuck on This application scope only, don't try to force it from the field. Avoid calling that scoped Script Include directly from the Global Company list filter. I would say use a reference qualifier instead of javascript:GetCompany()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
1st issue is the accessibility.
Script include can't be called unless you make it Accessible from All scopes
Did you try updating that?
from where are you calling that? share screenshots
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
for existing one it won't allow
please create new and then set it and use that
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thanks @sankur ,
It worked.
