com.glide.script.RhinoEcmaError: Cannot read property "variables" from null ERROR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 02:17 AM
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: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 05:08 AM
Do you get the same error changing the reference qualifier to this:
javascript: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 08:15 AM
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.