How to get Description,Resolution note,Additional info and additional comment in the article body.

Thej1
Tera Expert

HI

 

How to get the Description, Resolution note and last additional comment in the article body of kb article created by incident.

Created a knowledge article from an incident is resolved. (without plugin)

https://docs.servicenow.com/bundle/washingtondc-it-service-management/page/product/incident-manageme...

 

In BR "incident create knowledge', wrote a line '

kb.text = "Description: "+current.description + "<br>" + "Resolution Note: "+current.close_notes + "<br>" + "Additional info:"+current.u_additional_info + "<br>" + "Comments: "+current.comments.getHTMLValue();

 

it is coming as 

Thej1_0-1715954574905.png

can you help me to get the additional info same as like description by coming in the same line ?

 

Thanks

 

@Community Alums @Arpan Baishya @VaishnaviShinde @Kieran Anson 

4 REPLIES 4

Mark Manders
Mega Patron

Even though you didn't ask me, it could be something like this. Just check on your field names and also if everything is transferred to the correct format. 

 

var desc = current.description.getHTMLValue();
var resolution = current.resolution_notes.getHTMLValue();
var comment = current.comments.getJournalEntry(1).replace(/n+/g, '\n').trim();
kb.text = desc + '\n\n' + resolution + '\n\n' + comment;

 

 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hi @Mark Manders ,

 

\n is not working.

tried with 

kb.text = "Description: "+current.description + "<br>" + "Resolution Note: "+current.close_notes + "<br>""Additional info:"+current.u_additional_info + "<br>" + "Comments: "+current.comments.getHTMLValue();
 
it is coming as 
Thej1_0-1715954242894.png

can you help me to get the additional info same as like description by coming in the same line ?

 

Thanks

 

It looks like there already is a hard line break in the comments.

But: for a knowledge article, wouldn't it be better to put the text under the field? It's often multi line information and it gives a better overview if you don't put them on the same line.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

HI,

 

Yes. It is fine as it is defined as paragraph in HTML.

 

Thanks