logo

NJP

Quick Guide to add fields to knowledge article search results in service portal

Import · Apr 11, 2023 · article

Below is a quick example of how to add fields to the knowledge article search results card within service portal.

  • Navigate to EVAM > View Definitions > View Configuration
  • Select "Knowledge Search Results" for the Global Application
  • Add 'View count' to the list of Table Fields
  • Navigate to EVAM > View Definitions > View Templates
  • Select the "Knowledge Search Template" for the Global application
  • Update the JSON with the example below. (Note: this is showing the same additional field (view count) 2 times, this is just to demonstrate the use of the available detail fields)
    • There are 10 available details fields "detailLabelOne", "detailValueOne" > "detailLabelTen", "detailsValueTen"
{
    "component": "sn-search-result-evam-card",
    "staticValues": {
        "imageType": {
            "translatable": false,
            "key": "icon"
        },
        "icon": {
            "translatable": false,
            "key": "document-outline"
        },
        "detailLabelOne":{
            "key":"View Count:"
        },
        "detailLabelTwo":{
            "key":"View Count:"
        },
        "detailLabelSeparator":{
            "key":" | "
        },
        "detailPosition":{
            "key":"below"
        }
    },
    "mappings": {
        "textHeaderLabelOne": "topic", 
        "textHeaderLabelTwo": "number", 
        "textHeaderLabelThree": "sys_updated_on",
        "title": "ai_search_teaser_title",
        "summary": "ai_search_teaser_text",
        "detailValueOne":"sys_view_count",
        "detailValueTwo":"sys_view_count",
        "ariaLabel": "short_description" 
    },
    "actionMappings": {
        "clickAction": "navigation"
    }
}

Screen Shot 2023-04-11 at 5.16.35 PM.png

View original source

https://www.servicenow.com/community/ai-intelligence-articles/quick-guide-to-add-fields-to-knowledge-article-search-results-in/ta-p/2531623