Error Message Illegal access to method getRecord() in class com.glide.sys.User

Sri56
Tera Contributor

Hi All,

We are getting error message as "Error Message Illegal access to method getRecord() in class com.glide.sys.User" in our RITM form.

Where we have used default value for all variables to auto populate logged in user details like email,name,employee number,landline,first_name,last_name as below format:

javascript:gs.getUser().getRecord().getDisplayValue('location') ;

when we run a script in the background it is printing result as expected. However, few of our users are landing up with this error.

 

Please help me.

 

Thanks,

Sri

 

 

5 REPLIES 5

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi Sri,

The method getRecord() is no longer usable to access record field values.

For example a construct like:

javascript:gs.getUser().getRecord().getValue('department')

needs to be replaced with:

javascript:gs.getUser().getDepartmentID()

https://docs.servicenow.com/bundle/newyork-application-development/page/script/server-scripting/task...

In your case you can simply use the following:

javascript:gs.getUser().getLocation();

If this doesn't work, please try the solution provided below (using Script Include):

https://community.servicenow.com/community?id=community_question&sys_id=9a65287ddb54b3c413b5fb243996...

Hope this can fit your need!

If I have answered your question, please mark my response as correct and/or helpful.

Thank you very much

Cheers
Alberto

Hi Alberto,

 

Thanks for your response.

we are using many string variables like department,employeenumber...etc..

May i know is there any javascript method that can be used here?

 

Thanks,

Sri

You can try using:

javascript:gs.getUser().getLocation();

If this doesn't work, the only way to go define a new Script Include and call in the javascript code itself.

Cheers
Alberto

Hi Alberto,

 

Can you please help with this script include?

 

Thanks,

Sri