Beautify JSON Object in Incident via API

Benedikt Kaiser
Tera Contributor

Hi colleagues, 

 

I have a small problem with the ServiceNOW API.

 

I'm updating the work_notes in an Incident with the following JSON:

[
	{
		"requestId": "12345678910",
		"scriptOutput": "",
		"Action": "Status",
		"SvcName": "test",
		"ServiceInstalled": "True",
		"SvcStatus": "Running",
		"Result": "Success"
	},
	{
		"Action": "Status",
		"SvcName": "server",
		"ServiceInstalled": "False",
		"SvcStatus": "NULL",
		"Result": "Service Not Installed."
	},
	{
		"Task FAILED": "test failure",
		"CODE": "FAIL",
		"ACTION": "Dispatch Ticket To L2"
	}
]

 

When I update the Incident ticket the work_notes look like this: 

BenediktKaiser_0-1694608262536.png

 

Is there any way to format the work_notes in a beautify format?

 

thanks in advanced, 

Benedikt

1 REPLY 1

Tony Chatfield1
Kilo Patron

Hi, using a scripted rest api or transform\import process rather than posting your data directly to the target table would be my recommendation, otherwise you could use a BR on your target table to reformat the work_notes before the record is inserted.