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

Ankur Bawiskar
Tera Patron
Tera Patron

@shabbir9 

if those variables within variable sets are not part of MRVS then syntax is the same and it will work fine provided the variable type and field type are same

1) let the variable be standalone or part of single row variable set the syntax to get value is same

current.variables.<variableName>

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

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

i have done this but its not working...

no need to mention Variable set name (device) in the script..?? 

@shabbir9 

not required if that variable is present in single row variable set.

I already mentioned the same above.

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

for multirow variable set...??