How to Display Custom fields in the Knowledge Article?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 05:08 AM
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.
- Labels:
-
Knowledge Management
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 05:46 AM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2022 03:43 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2023 06:16 PM
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.