Advanced Reference Qualifier in a Dictionary Override on an Extended Task Table

Katie A
Mega Guru

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?

1 ACCEPTED SOLUTION

coryseering
ServiceNow Employee
ServiceNow Employee

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


View solution in original post

7 REPLIES 7

Ok great! All of that makes sense. Thank you so much for all of your thorough explanations. I appreciate it very much.



Best,


Kathryn


coryseering
ServiceNow Employee
ServiceNow Employee

I verified that this behavior is a bug- we want to execute JavaScript in Dictionary Overrides in the context of the scope the override is defined in, not in the scope of the field that the override applies to.



I'll be opening up a PRB on this when I have a few minutes to write up repeatable steps-to-reproduce on a fresh instance. I'll update this thread with the PRB number when I have.


coryseering
ServiceNow Employee
ServiceNow Employee

I've opened PRB642600 for this issue. To follow the progress on it's resolution, open an Incident in Hi and reference this PRB. You will then be able to follow any public updates made toward it's resolution.