Nayan Mahato
Tera Guru

RecordFieldGetter- An OOB ServiceNow Script include which can be used to get a value of any field from any table from the Client Side as shown below.

Input Arugments- 

  • sysparm_name- Always getValue
  • sysparm_table-- Any table name
  • sysparm_sys_id- Sys_id of a record
  • sysparm_field_name- Required field name

 

find_real_file.png

This can be called from client-side or Server-side as well.

**********************************

var si=new GlideAjax('RecordFieldGetter');
si.addParam('sysparm_name','getValue');
si.addParam('sysparm_table','sys_user');
si.addParam('sysparm_sys_id',g_user.userID);
si.addParam('sysparm_field_name','user_name');
si.getXMLAnswer(function(userNameValue){
alert(userNameValue);
});

Regards,

Nayan

Comments
Avinash Mahato1
Giga Expert

This is really helpful, Thanks!!

The SN Nerd
Giga Sage
Giga Sage

Wow, it doesn't use GlideRecordSecure.

Unless I am mistaken, this would mean that any authenticated user can get any data they want if they have a minimum of read access to the record, provided they know the table, sys_id and field name, which isn't hard to get, by pasting this code into the console.

 

Nayan Mahato
Tera Guru

Agree!, Paul. However, you can see they have a used canRead() check. So that should be fine.  Thanks.

Version history
Last update:
‎03-09-2022 12:28 PM
Updated by: