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

Querying sys_journal_field from workflow

miles9
Tera Expert

Hi, 

I am trying to figure out why my script is returning null from my query.  Basically I know the element_id is in the table and the query does run but once it its the gs.log portion it prints out "IS THIS CORRECT" but the value it returns for the column is null or undefined.

 

This is just a snippet of the full script but this part is where I am running into issues.

var gr = new GlideRecord('sys_journal_field');
	gr.addQuery('element_id', '=' ,'elementID');
	gr.query();
        gs.log('IS THIS CORRECT ' + gr.getValue('value'));
  

 

1 REPLY 1

Jaspal Singh
Mega Patron
Mega Patron

Try below

var gr = new GlideRecord('sys_journal_field');
	gr.addQuery('element_id', '=' ,'elementID');
	gr.query();
if(gr.next()){
        gs.log('IS THIS CORRECT ' + gr.getValue('value'));
}