How to convert the Transform map source object into JSON String?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2019 12:14 PM
I am trying to convert the source object values to a json string in the transform script of Import set table. I dont find any promising input from servicenow documentation.
Labels:
- Labels:
-
Cost Management
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2019 01:21 PM
Hi Rajesh, what have you tried so far and what is the overall requirement you're trying to achieve here?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2019 01:38 PM
Hi Brad,
I am trying to call the IRE engine from transform script of Import set table(Scoped Application). As per the documentation link, i have implemented the same script in my import set table transform map script area.
var payload = {items: [{className:'cmdb_ci_linux_server', values: {name:'stry0900844 CI 2', serial_number:'9876EFGH', mac_address:'4653XYZ', ip_address:'10.10.10.4', ram:'1238'}}] }; var jsonUntil = new JSON(); var input = jsonUntil.encode(payload); var output = sn_cmdb.IdentificationEngine.createOrUpdateCI('ServiceNow', input); gs.print(output);
In the above script, instead of getting each attribute name value pair from the source object, I am trying to convert the source object to JSON string so that way I can pass the converted JSON string for to make it work.
I tried the following but no luck.
var payload = {items: [{className:'cmdb_ci_linux_server', values: source}] }; var jsonUntil = new JSON(); var input = jsonUntil.encode(payload); var output = sn_cmdb.IdentificationEngine.createOrUpdateCI('ServiceNow', input); gs.print(output);
Thank you,
Rajesh