Creating Custom EVAM configurations for AI Search source [How To]
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
- Entity - data source
- View - how a card would be displayed
- Action - an action that can be performed on or through the card
- 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.
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 )
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 resultsUpdate 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.
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
Navigate to the Service portal and search for a user, your search results should be displayed with the updated customizations.
Useful links:
a) Community article to update navigation of search result
b) Community article to update fields in EVAM view config
https://www.servicenow.com/community/ai-intelligence-articles/creating-custom-evam-configurations-for-ai-search-source-how-to/ta-p/2382189
