gliderecord error

Hafila Hatta
Tera Guru

hi. i keep getting this error in my flow. could anyone help to with this error? not sure if my script is the issue

 

here is my script:

 

var acc_name = fd_data._3__for_each.item.accessory;

var var_count = new GlideRecord('u_inventory_accessories_count');
var_count.addQuery('sys_id', acc_name);
var_count.query();

if (var_count.next()) {
    var result = var_count.getValue('u_current_stock_count');
    var new_result = result - 1;
    return new_result;
}

 

HafilaHatta_0-1741143247315.png

HafilaHatta_1-1741143267391.png

 

1 ACCEPTED SOLUTION

hi. solved this issue. apparently, no issue with the script but the 'look up' action was not returning any result. just had to change the look up condition to sys_id field and it works fine. 

 

thanks for ur help 

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@Hafila Hatta 

did you try to add logs and see?

are you querying with the correct table and field?

var acc_name = fd_data._3__for_each.item.accessory;

gs.info('Acc name' + acc_name);

var var_count = new GlideRecord('u_inventory_accessories_count');
var_count.addQuery('sys_id', acc_name);
var_count.query();

if (var_count.next()) {
	gs.info('Inside record found');
    var result = var_count.getValue('u_current_stock_count');
    var new_result = result - 1;
	gs.info('result' + result);
    return new_result;
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

yes, it is the correct table and field. getting the same error using ur script

HafilaHatta_0-1741144133509.png

 

@Hafila Hatta 

did you add logs as per I shared and check which came fine?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Hafila Hatta 

Any update to this?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader