Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Glide_var field types

Uday16
Tera Contributor

Hi Everyone,

Can anyone help me understand how can we parse glide_var type fields and separate their values. Only information I can find on internet is this link.

https://www.jds.net.au/glide-variables/

We need to store the values from this glide_var type field and use the same.

Please help if any idea about the same.

 

Regards,

Uday

3 REPLIES 3

Maik Skoddow
Tera Patron

Hi @Uday 

I don't understand your issue, as in the referenced web page there is an example on how to read the variable names and values:

var gr = new GlideRecord('<TABLE NAME>');

gr.get('<SYS ID>');

// 'inputs' is the name of the field of type 'glide_var'
for(var eachVariable in gr.inputs) {
  gs.info(eachVariable + ' : ' + gr.inputs[eachVariable]);
}

 

What exactly do you miss?

Kind regards
Maik

Shubham44
ServiceNow Employee

Hi Uday,

PFB the sample code, please mark the reply helpful as appropriate

var ordertaskGr= new GlideRecord('sn_ind_tmt_orm_order_task');//table name of the order task
ordertaskGr.get('244e9ff45b5620102dff5e92dc81c7bd'); //sys_id of the order task


for(var eachVariable in orderGr.characteristics) {
  gs.info(eachVariable + ' : ' + orderGr.characteristics[eachVariable]);
}

Not applicable

This thread helped me in understanding and implementing the below solution what I was looking for:

var gr = new GlideRecord('sys_hub_action_instance')
gr.get('318450411b5c81104a61ebd22a4bcbc7')

for(var eachVariable in gr.action_inputs){
gs.info(eachVariable + ' : ' + gr.action_inputs[eachVariable])
}
//output

*** Script: sys_meta : action_inputs
*** Script: table_name : sc_req_item
*** Script: record : 
*** Script: values : comments=Request has been processed in ServiceNow.^state=3^stage=complete
*** Script: sys_id : 318450411b5c81104a61ebd22a4bcbc7

Thanks,

Raghu.