how to get RITM variables in Client callable script include, I am attaching the picture of code

Chandu14
Tera Contributor

how to get RITM variables in Client callable script include, I am attaching the picture of code.

 

get_Request_Details: function() {
var array = [];
var bsid = this.getParameter('sysparm_sys_id');
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', bsid);
gr.query();
gs.info("CHECK <<<<< 00:" + bsid);
if (gr.next()) {
var ff = gr.number;
var gf = gr.type;

var obj = {

type: gr.variables.type,

employee_type: gr.variables.employee_type,
report_to: gr.variables.report_to,
direct_reports: gr.variables.direct_reports,
preferred_first_name: gr.variables.preferred_first_name,
legal_name: gr.variables.legal_name,
work_in_location: gr.variables.work_in_location,
state_name: gr.variables.state_name,
};
}
array.push(obj);
gs.info("CHECK <<<<< :" + JSON.stringify(array) + "OBJ" + JSON.stringify(obj) +"<<<< "+ ff +"<<<< "+ gf);

 

 

 

I am gettiing the array object as empty log as mentioned below

[{"type":{},"report_to":{},"direct_reports":{},"preferred_first_name":{},"legal_name":{},"work_in_location":{},"state_name":{}}]OBJ{"type":{},"report_to":{},"direct_reports":{},"preferred_first_name":{},"legal_name":{},"work_in_location":{},"state_name":{}}

7 REPLIES 7

Tudor
Tera Guru

Hello,

The logic is set up so that if you call ... current.variables.type you will get the value of the selection.

https://docs.servicenow.com/en-US/bundle/sandiego-application-development/page/script/server-scripting/concept/c_ScriptableServiceCatalogVariables.html

Hope this helps!

 Tudor

Chandu14
Tera Contributor

if am using current it's not working

Chandu Telu
Tera Guru
Tera Guru

Hi,

Actually what is sys_id your sending ?? is this script calling from catalog client script or client script ??

 

Mark my answer correct & Helpful, if Applicable.

Thanks,
Chandu Telu

 

 

the sysid sending is RITM sysid , and the script include is calling from Catalog client script.