Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to resolve this error "Read operation on table 'sn_hr_core_case_workforce_admin' from "global"

Prathamesh Cha1
Tera Contributor

Hi All,

 

How to resolve below error

PrathameshCha1_0-1698415754833.png

Read operation on table 'sn_hr_core_case_workforce_admin' from scope 'Global' was denied because the source could not be found. Please contact the application admin.

 

 

 

7 REPLIES 7

Sandeep Rajput
Tera Patron
Tera Patron

@Prathamesh Cha1 Use the following steps to fix this issue.

1. Select the application scope as Human Resources Core Scope.

Screenshot 2023-10-27 at 9.54.08 PM.png

2. Navigate to Application Restricted Caller Access Module

Screenshot 2023-10-27 at 9.54.43 PM.png

3. Create a new record as follows.

Screenshot 2023-10-27 at 9.56.49 PM.png

Submit the record and try running the script again. This time the errors will not appear.

 

Hope this helps.

Hi @Sandeep Rajput ,

 I have created record as you said, But Here I am getting "undefined" or "null" as output.

PrathameshCha1_0-1698514635523.png

 

PrathameshCha1_1-1698514789044.png

 

Actually I am trying this script in email script, and get the data in notification body but I am getting undefined as output,

PrathameshCha1_2-1698514833437.png

PrathameshCha1_3-1698514921650.png

 

PrathameshCha1_4-1698514963543.png

 

Here Undefined is the output here I am trying to fetch value of "value" field from question_answer table

 

PrathameshCha1_5-1698515297186.png

 

code:

 

     var date = new GlideRecord('question_answer');
          date.addQuery('table_sys_id', 'e8d2c4a71b8e3d901eeafc07cb4bcbe5');
          date.addQuery('question', 'ad28230f1bccb9501eeafc07cb4bcb61');
          date.query();
          if(date.next()){
            var val = date.getValue('value');
          }

         // template.print(gs.getMessage(val));
          template.print(val);

 

 

 

@Prathamesh Cha1 

PrathameshCha1_2-1698514833437.png

While reviewing your script, I observed an issue on line number 14 where you have defined a local variable 

var val = date.getValue('value');

 

On line number 18 you are trying to access this variable

template.print(val);

The script will crash on the above line as val is a local variable declared inside if and being accessed outside its scope.

 

Please declare the var val=''; outside the if statement as follows.

 

var val='';
if(date.next()){
val=date.getValue('value');
}
template.print(val);

Hope this fixes your issue.

 

tried this but still value is not coming,

 

PrathameshCha1_4-1698521500112.png

 

 

PrathameshCha1_3-1698521457848.png

 var val = '';
          var date = new GlideRecord('question_answer');
          date.addQuery('table_sys_id', 'e8d2c4a71b8e3d901eeafc07cb4bcbe5');
          date.addQuery('question', 'ad28230f1bccb9501eeafc07cb4bcb61');
          date.query();
          if(date.next()){
             val = date.getValue('value');
          }

         // template.print(gs.getMessage(val));
          template.print(date.value);