com.glide.script.RhinoEcmaError: Cannot read property "variables" from null ERROR

Jaeik Lee
Mega Sage

Hi.

When i made script include in Default Value in the catalog variable(Reference Field).

But in test, Error occured.

 

that is my code:

<Default value>

javascript&colon;new global.KBFilter().getDefaultValue(current.variables.ref_svcgroup.getValue() , current.variables.approver_department.getValue());

 

<script include>

getDefaultValue:function(a, b){
var service = a;
var id = b;
gs.log('============================================');
var arr = [];
var compGr = new GlideRecord('core_company');

if(compGr.get("sys_id" , gs.getUser().getCompanyID())){
gs.log(gs.getUser().getCompanyID());


if(compGr.u_company_code == 'B0'){
gs.log(gs.getUser().getRecord().getValue("u_team_leader"));
return gs.getUser().getRecord().getValue("u_team_leader");
}else{
if(service == ''){
return '';
}else{
var gr = new GlideRecord("u_svc_service_group");
gr.addQuery("sys_id", service);
gr.query();
while(gr.next()) {
arr.push(gr.getValue('u_service_manager_id'));
}
return 'sys_idIN' + arr.toString();
}
}
}

 

and It is Error

com.glide.script.RhinoEcmaError: Cannot read property "variables" from null

 

Thank you for help

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

Do you get the same error changing the reference qualifier to this:

javascript&colon;new global.KBFilter().getDefaultValue(current.variables.ref_svcgroup, current.variables.approver_department);

and then the SI will need to accept sys_ids if these variables are reference types.

Andy Homar
Giga Guru

You can't use current when defining a default value.  You'll have to use an onChange client script to call that script include when those variables change.