The CreatorCon Call for Content is officially open! Get started here.

Why is field not found when running script from within a scope?

lss123
Tera Contributor

I run the script below from the Background Scripts module with the scope set to "global" and I have no issues.   However, if I switch the scope to another scoped application, I get the error "field name 'product.u_development_offering' not found in table 'rm_story'".

Why is this and how can I run a script from within a scope and access this u_development_offering field?

A few of other notes:

  • The u_development_offering field is a custom field added to the cmdb_application_product_model table
  • I do not get this error when changing "u_development_offering" to be an out-of-the-box field on that same table, like "name" or "short_description"
  • I cannot see any system log messages and this script did not generate a cross-scope access record (so assuming cross-scope access is not an issue)

var gr = new GlideRecord("rm_story");

gr.addQuery("state", "2");

gr.addQuery("product.u_development_offering", "Self Service");

gr.query();

while (gr.next()) {

  gs.info("story: " + gr.number + ": " + gr.product.name);

}

6 REPLIES 6

sachin_namjoshi
Kilo Patron
Kilo Patron

Hi,



This is expected since you added column in global scope.


cmdb_application_product_model table is part of GLOBAL scope.



Regards,


Sachin


Yes, but I can access the out-of-the-box columns just fine, and they are in global too.   This issue seems limited to custom columns created on this table.


Community Alums
Not applicable

The table you're querying is part of an application. That application is set to not allow querying from outside application scope. you can view this by going here:
find_real_file.png


The table I'm querying is in global, and I'm able to query out-of-the-box fields on it just fine.   It seems that it's just the custom fields that are an issue.   Also, the scope I'm running it from does not enforce cross-scope access, so I don't think I'd need to create cross-scope access records.