What is this error called "undefined" or "null"

Prathamesh Cha1
Tera Contributor

Hi all,

Can anyone tell me why this error is coming, here I am trying to fetch value of "value" field of record from "question_answer" table. 

 

PrathameshCha1_0-1698512570187.png

 

PrathameshCha1_1-1698512744128.png

 

 

10 REPLIES 10

Prathamesh Cha1
Tera Contributor

Hi @Jaspal Singh @OlaN ,

 

I tried that still I am getting empty nothing, even though there is value.

 

PrathameshCha1_1-1698520475785.png

trying to fetch below record

 

PrathameshCha1_2-1698520522240.png

 

 

Hi,

The fact that you are using gs.print() states that you are running the script in global scope.

And since this thread is in the HRSD forum, I believe that the record you are querying belongs to the HR-scope.  So I'm guessing that that is the issue. You cannot access that record from the global scope.

Can you try to switch scope when running the script, and replace gs.print() with gs.info() as I suggested earlier.

Raghu Ram Y
Kilo Sage

Hello @Prathamesh Cha1 

 

I was just going through your conversations, it seems interesting.. so to further debug on your issue firstly, I would suggest to query that particular record using sys_id and check whether "value" is getting printed or not.

 

Please mark my response as both HELPFUL and CORRECT, if it helps.

 

Regards,

Raghu.

Hi@Raghu Ram Y 

with sys_id its working but my requirement is after submitting record on record producer in esc portal using HR case sys_id, and then variable sys I want to fetch this value to reflet it in notification, in place of table sys_id I will be using current.sys_id to fetch sys id of hr case

 

 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);
 
 
above is my script

Okay, if it's working when you given sys id means,, then your query might be incorrect, or as your saying it some scope thing then could you have a look on "Cross Scope application" privileges?


Let me know if we can check quickly jump into a call to further check on this,. Happy to help.

 

Please mark my response as both HELPFUL and CORRECT, if it's helps..


Regards,

Raghu.