How to Display Custom fields in the Knowledge Article?

Harish Kota2
Tera Contributor

How to Display Custom fields in the View Article as per the Screenshots?

Need to Display the Service Offering custom field in the View Article.

3 REPLIES 3

Vipul Sethi
Kilo Guru

One way I can think of is to add the data in article text body by dynamically adding the service offering when knowledge state changes to publish this can be done by before update business rule where condition will be state "changes to publish", PFB the example code in which I am adding valid to to article text body from before update BR

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var text = current.text;
	var addnewtext = "<h1>Valid to</h1> : "+current.valid_to.toString() + "/n";  // Add valid to dynamically in content body
	var finaltext = addnewtext + text;
	current.text = finaltext;
	

})(current, previous);

find_real_file.png

Hi Vipul,

Thanks for the response, I need to dynamically update the Service offering when we can view the article, Please find the screenshots, what i am looking for.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0955875

Description

  • The custom fields on the knowledge article are not displaying 
  • how to display them

Instructions

  • Navigate to System UI > UI Macros.
  • Search for a macro, Name = kb_view_common_content, and open this record
  • Insert the following line
    $[NS:knowledgeRecord.u_myCustom_html_field]
  • In between the following div tag And make sure to replace
  •     ->u_myCustom_html_field
        ->with the database field name that you copied in step 5.
        ->Click 'Update' down below.
  • The custom field will now be visible when viewing Knowledge articles.