Shuravi
ServiceNow Employee
ServiceNow Employee

In this technical How To article, we'll cover the view configuration steps needed to create a custom EVAM config for AI Search results specific to the search source.
For new configurations, we need to identify the following

  1. Entity - data source
  2. View  - how a card would be displayed 
  3. Action - an action that can be performed on or through the card
  4. Map - mapping data source data to component properties

In this article, we will cover the view and mapping of an entity. I will link an article for action configurations.
In this use case, we will create EVAM config for sys_user  (Entity) search source for Service Portal, which OOB uses the Default Search Results EVAM config. 

Screen Shot 2022-11-14 at 11.01.50 AM.png

 

Creating View template for search result [View] : 


Navigate to EVAM -> View Templates -> Click to open Default Search Template.
Update the Name to User Search Template.
Right-click on the ribbon and select the Insert and stay option (this will create a new record with the User search template )

Screen Shot 2022-11-14 at 11.20.17 AM.png

Insert the below code in the template field

{
    "component": "sn-search-result-evam-card",
        "staticValues": {
        "imageType": {
            "translatable": false,
            "key": "avatar"
        }
    },
    "mappings": {
        "avatarURL": "avatar",
        "avatarName": "name",
        "textHeaderLabelOne": "location",
        "textHeaderLabelTwo": "email",
        "title": "ai_search_teaser_title",
        "summary": "ai_search_teaser_text",
        "ariaLabel": "name"
    },
    "actionMappings": {
        "clickAction": "navigation"
    }
}
Note :- a) The component needs to be updated to sn-search-genius-qa-card for Q&A custom GRs
b) All fields mapped here that are not present in Field setting mappings of the AI Search indexed source need to be added in Table fields option of the view configurations. [Refer Step 5 of View Configurations option below]

 

Create a New Configuration for search result [Map] : 

 

All EVAM configs are bundled separately for each portal and referenced for display through Search Application Configuration. All configurations created need to be added to the portal bundle. In our use case this is Service portal bundle
EVAM -> EVAM View Config Bundles -> Service Portal Config bundle

Click to open Default search results
Update Name to User search results
Right-click on the ribbon and select the Insert and stay option (this will create a new record with the User search template )

Note: create a new configurations updating default OOB configurations are not recommended.

 

Screen Shot 2022-11-14 at 11.46.42 AM.png

Update Table field to the data source you are creating this config for. In our case sys_user.

In Table fields options ,we can add fields present on the data source that we want to display in the search results. For this example I have added the Name, location and email.
Update the View Template field to refer the template created above in our case User search Template

Click on Save. 
This is how the updated config should look like


Screen Shot 2022-11-14 at 12.06.37 PM.png


Navigate to the Service portal and search for a user, your search results should be displayed with the updated customizations.

Screen Shot 2022-11-14 at 12.15.13 PM.png

 

Useful links:
a)  Community article to update navigation of search result 
b) Community article to update fields in EVAM view config 

Comments
G_30
Tera Contributor

Is the portal page is the result when the user tries to click on the searched user? I'm having an issue with the redirecting the page to portal when the user tries to click on the searched result.

Carlo Jimenez
Tera Contributor

Hi @Shuravi, were there updates or changes to navigation in the Washington DC release? I noticed that indexed external sources were appended by "searchTerm=" followed by the name of the indexed item. Can you help me point to the right direction where should I be looking at? Thank you!

Version history
Last update:
‎06-14-2023 01:02 PM
Updated by:
Contributors