
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 10:57 AM
I am in building a new custom application in Fuji. I have a table that is extended from Task.
I added a Reference field to this table. The Reference points to cmdb_ci_computer.
I have used a Dictionary Override to apply an Advanced Reference Qualifier on that field.
I have been trying to call a script include to populate the Reference field. The script include function is in the same application scope as the custom table.
The advanced Reference Qualifier is as such:
javascript:LoanerReferenceQual().getAvailCis();
However, there is an error in the log: The function is not defined.
org.mozilla.javascript.EcmaError: "LoanerReferenceQual" is not defined.
Caused by error in <refname> at line 1
==> 1: LoanerReferenceQual().getAvailCis();
Is this because the cmdb_ci_computer table is in the global scope? The Dictionary Override itself is definitely within my new application scope. Do I need to do anything special to call a reference qualifier on a table in the global scope in a Dictionary Override?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 10:23 PM
Hi Kathryn,
Tables you create in a scoped application always have the scope name on front. Columns you add on a table outside of your scope will also have the scope name on the front. Columns you add to your own tables are not subject to that- if you create a table named "x_spoon_cutlery" in your "x_spoon" application, then you can add a field named simply "fork" and you won't need to use the scope name to access that field.
Variables are a special case, because they are records in another table rather than columns on an existing table, but have the potential to collide if multiple scoped applications add variables to the same items. So those have the scope name on them.
It's about namespacing and removing collisions. You shouldn't accidentally mess up someone else's application just by using a common, descriptive name- and they shouldn't mess up yours.
The only case (from what you've described so far) that I am not convinced is working as intended is the original scope-name-required-on-dictionary-override, which I will check for on Monday.
Thanks
Cory

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 12:05 PM
I was able to solve the issue. I just had to enter the fully-qualified API name of the script include in the reference qualifier.
javascript:x_myscp_loaner_res.LoanerReferenceQual().getAvailCis()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 01:12 PM
Hi Kathryn,
I'm not sure that is intended behavior. When I get in on Monday I'll take a look and see if I need to raise a PRB. Typically, if you have JavaScript in a scoped record, it should execute in that record's scope. There may be an exception in this case, but it could also be a bug.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 10:16 PM
Hi Cory,
I noticed that I have to use the fully-qualified API name on ALL variables. Is that normal? All of the artifacts are in the same scope.
Here's an example of code in a Script Include that is in the same application scope.
var item_type = current.item_type; // will return undefined
var item_type = current.x_myscp_loaner_res_item_type; // will return the correct value
We upgraded to Fuji recently. I am building a new application from scratch in Fuji for the first time. I have built this entire application using this long-handed method of writing out the fully-qualified API name for all variable names. Otherwise I get the error "not defined". I was a bit surprised that I had to type out the whole name but I suppose I just thought it was the new way to code scoped applications.
Here is another example.
var lr = new GlideRecord('x_myscp_loaner_res_loaner_reservation'); // will not work without fully-qualified name
Thank you again for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2015 10:23 PM
Hi Kathryn,
Tables you create in a scoped application always have the scope name on front. Columns you add on a table outside of your scope will also have the scope name on the front. Columns you add to your own tables are not subject to that- if you create a table named "x_spoon_cutlery" in your "x_spoon" application, then you can add a field named simply "fork" and you won't need to use the scope name to access that field.
Variables are a special case, because they are records in another table rather than columns on an existing table, but have the potential to collide if multiple scoped applications add variables to the same items. So those have the scope name on them.
It's about namespacing and removing collisions. You shouldn't accidentally mess up someone else's application just by using a common, descriptive name- and they shouldn't mess up yours.
The only case (from what you've described so far) that I am not convinced is working as intended is the original scope-name-required-on-dictionary-override, which I will check for on Monday.
Thanks
Cory