- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 10:52 PM
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 )
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 03:37 AM
like this
var val = current.variables.device;
var parser = JSON.parse(val);
obj.device_mac = parser[0].name_service + "";
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 11:07 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 01:49 AM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 01:54 AM
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 + "";
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader