How can I reference data in a global scope table from an application in a specific application scope?

shigehisa
Kilo Contributor

How can I reference data in a global scope table from an application in a specific application scope?
Specifically, I am trying to refer to the data of the globe table by GlideRecord on the server side using Script Include, but I cannot refer to it. I think it's probably a permission issue, but I don't know exactly where and what to set it to work.

6 REPLIES 6

DScroggins
Kilo Sage

Hello,

In order to access data in a global table from a different scope the global table needs to specifically allow cross scope access. You can validate what access the table allows by navigating to sys_db_object.list. Find the table in question using the Name or label. Open record and look at the 'Application Access' tab. There you will see if the data is accessible from 'This application scope only' or 'All application scopes'. You can also see what access other scopes have:

find_real_file.png

 

Hope this helps.

--David

shigehisa
Kilo Contributor

Thank you very much. When I checked, the setting of'Application Access 'tab was'All application scopes'. Is there any other possible factor? For example, regarding the role, is there any relation between the setting on the application side of the access source and the global scope table side?

Just to clarify you have a script include in a scoped application which is trying to use a GlideRecord query to get data from the table in global scope? Are you able to share the script which isn't fetching the data as expected?

function getName() {
    var rec = new GlideRecord('u_test_global_table');
    rec.query();
    while(rec.next()) {
        return rec.name;
    }
}

 

-----

The source code of the corresponding part. I have confirmed that you can pass this code.