How to pass multiline Description while raising ServiceNow incident using API call

Hi All,

I’m trying to add multiline description and also want to add data table rows in description while raising ServiceNow incident through API using HttpClient activities. I tried using ‘\n’ and ‘\n’, but I’m unable to do so.

This is how I wanted incident description to be -

Hi team,

We see the following blocking sessions .Please clear them immediately.

INST_ID MACHINE USERNAME STATUS SID SERIAL# MINS_RUNNING SQL_ID HASH_VALUE BLOCKING_SESSION BLOCKING_INSTANCE PROCESS
4 xyz-o101b xyzLREAD ACTIVE 7325 265 1.15 9q5n 1868 X Y 9552

Regards,
XYZ team

Below are the details I’ve used -

EndPoint URL - https://xyz.service-now.com/api/now/table/incident

Body -
{“short_description”:“”,
“description”:“”,
“assignment_group”:“”,
“watch_list”:“”,
“caller_id”:“”}

I’ve used Simple Authentication here.

I’m able to raise incident without new line but with new lines it’s giving error.

Can anyone please help here it’s urgent?

“line one” + VbCrLf + “line two”

Hi @postwick , I’ve passed

"Hi Team, "+VbCrLf+“Please check…”

But that’s not working…

“{"error":{"message":"Exception while reading request","detail":"The payload is not valid JSON."},"status":"failure"}”

Ticket Body -

@"
{
““short_description””:““Sel - Printer””,
““description””:““Hi Team,
Please check the “”,
““assignment_group””:”“NA””,
““watch_list””:““arpit.sharma””,
““caller_id””:““RPA Bot””
}"

Show us the JSON you’re trying to send.

\n isn’t working because you have to escape the \ for JSON. Try \\n instead of \n

Below is the Json data I’m trying to send -

And in Description = "Hi Team, +VbCrLf+ Please check the ".

@"
{
““short_description””:““Sel - Printer””,
““description””:““Hi Team,
Please check the “”,
““assignment_group””:”“NA””,
““watch_list””:““arpit.sharma””,
““caller_id””:““RPA Bot””
}"

You want me to try and pass in assign -
Description = "Hi Team, \n Please check the "

You don’t put the +VbCrLf+ inside the string.

"Hi Team, " + VbCrLf + "Please check the "

You don’t put the +VbCrLf+ inside the string it’s a constant variable.

"Hi Team, " + VbCrLf + "Please check the..."

Again, though, \n should work but you have to escape the \:

"Hi Team,\\nPlease check..."

It’s reflecting like -

image

image

Don’t use the VbCrLf and the \\n at the same time. Use just the \\n inside the string.

{"short_description":"Sel - Printer",
"description":"Hi Team,\\nPlease check the ",
"assignment_group":"NA",
"watch_list":"arpit.sharma",
"caller_id":"RPA Bot"
}

I haven’t used VbCrLf and \\n at the same time time…

image

Hi @arpitsharma1.sharma

Try with

<br><br>

I am using this with ServiceNow UiPath activities and it works.

Thanks Rahul, that worked… :slight_smile:

I had one more requirement that is after new line I need to add data table too in description of SNOW ticket. Can you help me that ?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.