VARIABLE SETS

shabbir9
Tera Contributor

HII

 

obj.device_mac = current.variables.device_mac + "";
obj.device_hostname = current.variables.device_hostname + "";   

 

iam mapping other application Fields to ServiceNow variables its working fine with this code but now i need to replace variables with variable set ..can anyone suggest how can i replace variables with variable set variables...(my variable set name is "device" and into this variable sets variable names are 1.name_service  2. pass_value   )

 

1 ACCEPTED SOLUTION

@shabbir9 

like this

var val = current.variables.device;

var parser = JSON.parse(val);

obj.device_mac = parser[0].name_service + "";   

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

SUBHAM AGARWAL
Tera Guru

Hello,

You can use same as

current.variables.variable_setName.toString() . It will give you json object will all the varibales of variable set then you can get the varibles value from that json object.

 

Thanks

in my scenario -  obj.device_mac = current.variables.variable_device.name_service + "";

 

is this correct..?? device is my variable set name and name_service is variable inside the variable set(device)

@shabbir9 

As I said above if variable_device is single row variable set and not MRVS then directly use this to get variable value

obj.device_mac = current.variables.name_service + "";

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader