sys_db_object query getting error inside scope application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 04:32 PM
Ultimately, what I'm trying to do is get all child tables of a parent table. The TableUtils will not work as GlideDBObjectManager cannot be called from within a scoped application...so I figured I'd write my own...Only I'm getting an error: Method "query" called on incompatible object.
My code sits at the global app:
getAllExtensions: function(tableName) {
var gr = new GlideRecord('sys_db_object');
gr.get('name', tableName);
var arr = new Array();
var subs = new GlideRecord('sys_db_object');
subs.addQuery('super_class', gr.sys_id);
subs.query();
while (subs.next())
arr.push(subs.name.toString());
return arr;
},
},
}
This works perfectly fine if I run inside global, if I execute the same code in my scoped, I get the above error.
sys_db_object table is accessible from all app scopes, and 'Can Read' is checked. ACLs show that you just need itil role (which I have, I'm admin) to read...
Is there something I'm missing, does SN have this locked down in some way that isn't visible? Any help would be appreciated. Remember, my goal is to get all child tables from a parent table's name.
EDIT: For clarification my current schema is as follows:
Global Script Include: has the above getAllExtensions function
Scoped Script Include: has a function getSomething() that basically does: return new global.MyScriptInclude().getAllExtensions('x_abc_abc_requests').join(',');
Scope Module: List of Records with argument: sys_class_nameINjavascript:new x_abc_abc.MyScopedScriptInclude().getSomething();
This fails....
However, I just found that if I skip the global script include and simply copy the getAllExtensions code into my scoped script include, it magically works. I verified that all script includes involved have All application scopes. I have a work around as a result, but that still doesn't explain what is going on. Is this a bug or WAI?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2017 06:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 11:05 AM
So I added the cross scope privileges, but nothing changed. I'm still getting that error...here's some SSs:
Module:
Scoped Script:
Global Script:
Cross Scope Priv:
I have since updated the requested to Allowed for the GlideAPI
error message:
Any other thoughts? If I copy the global into the scoped script, it works just fine. What is it about being in global that is throwing it off?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 08:59 PM
Did you try this way in argumnets?
Since you are calling global SI in Scoped SI, directly call that global SI in arguments
sys_class_nameINjavascript: new global.TBCGlideRecordUtils().getAllRequests()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 09:16 AM
I tried that, and now I'm getting another error: 'undefined is not a function. Caused by error in <refname> at line 1. ==> 1: new global TBCGlideRecordUtils().getAllRequests()'
I have TBCGlideRecordUtils defined in the cross scope, and it is All application scopes...something really funky is going on...
