- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2023 10:23 PM
Hi , searching for a term in service portal does return results but also returns blank card when view is set to card view.
when we change the view to list view/grid view , there are lines coming in between the populated articles which represent as some article .
WHy do you think that happens?
please find screenshot
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 02:53 PM
Hi Rachana,
Do you have attachments index on any of your AI search index sources? If so, it's trying to display those results and doesn't have the correct widget to display the card content.
To fix this you'll need to clone the "Topic Content" widget and add the Attachment table to contentTabletoWidget
Then you'll need to create a new widget to display the content, I just cloned the kb-content widget.
Here's the server script I cleaned up
(function () {
var attSysId = options.content;
var attTable = options.content_table;
var isFeatured = options.isFeatured || false;
var viewType = options.listType || 'card';
var title = options.widgetTitle;
var widgetSysId = options.widgetSysId;
var searchModeEnabled = options.searchModeEnabled || false;
var topicId = options.topicForBreadcrumb;
data.attCardData = {};
data.attCardData.iconClass = "fa fa-file-text-o";
data.attCardData.type = gs.getMessage("Attachment");
data.attCardData.isFeatured = isFeatured;
data.attCardData.viewType = viewType;
data.attCardData.widgetTitle = title;
data.attCardData.widgetSysId = widgetSysId;
data.attCardData.sysId = attSysId;
data.attCardData.table = "sys_attachment";
if (searchModeEnabled) {
data.attCardData.title = options.title;
data.attCardData.description = options.text;
data.attCardData.image = options.image ? options.image + '?t=small' : '';
data.attCardData.url = '?id=kb_article&sysparm_article=' + options.number;
if(topicId){
data.attCardData.url += '&topic_id='+topicId;
}
data.attCardData.additionalInfo = options.sys_updated_on;
data.widgetData = $sp.getWidget("content-card", data.attCardData);
}
else {
if (!attSysId || !attTable)
return;
var gr = new GlideRecordSecure(attTable);
if (gr.get(attSysId)) {
data.attCardData.title = gr.getDisplayValue('file_name');
var description = gr.getDisplayValue('text');
data.attCardData.description = !description ? '' : $sp.stripHTML(description);
data.attCardData.image = gr.getDisplayValue('image') ? gr.getDisplayValue('image') + '?t=small' : '';
data.attCardData.url = '?id=kb_article&sysparm_article=' + gr.getValue('number');
if(topicId){
data.attCardData.url += '&topic_id='+topicId;
}
data.attCardData.additionalInfo = gr.getDisplayValue('sys_updated_on');
data.widgetData = $sp.getWidget("content-card", data.attCardData);
} else
return;
}
})();
Then change the portal page to display the customised widget.
The OOB widget is only setup for Catalog items and KB articles, so if it's not the attachments that is causing the issue. I would do a $scope.data dump on the Topic Content widget and check the console to see what is missing, you'll find the table under aisSearchResults
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2023 11:33 PM
@rachana_patel I think you dont have access to see those items. Check the user criteria on those items.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2023 02:53 PM
Hi Rachana,
Do you have attachments index on any of your AI search index sources? If so, it's trying to display those results and doesn't have the correct widget to display the card content.
To fix this you'll need to clone the "Topic Content" widget and add the Attachment table to contentTabletoWidget
Then you'll need to create a new widget to display the content, I just cloned the kb-content widget.
Here's the server script I cleaned up
(function () {
var attSysId = options.content;
var attTable = options.content_table;
var isFeatured = options.isFeatured || false;
var viewType = options.listType || 'card';
var title = options.widgetTitle;
var widgetSysId = options.widgetSysId;
var searchModeEnabled = options.searchModeEnabled || false;
var topicId = options.topicForBreadcrumb;
data.attCardData = {};
data.attCardData.iconClass = "fa fa-file-text-o";
data.attCardData.type = gs.getMessage("Attachment");
data.attCardData.isFeatured = isFeatured;
data.attCardData.viewType = viewType;
data.attCardData.widgetTitle = title;
data.attCardData.widgetSysId = widgetSysId;
data.attCardData.sysId = attSysId;
data.attCardData.table = "sys_attachment";
if (searchModeEnabled) {
data.attCardData.title = options.title;
data.attCardData.description = options.text;
data.attCardData.image = options.image ? options.image + '?t=small' : '';
data.attCardData.url = '?id=kb_article&sysparm_article=' + options.number;
if(topicId){
data.attCardData.url += '&topic_id='+topicId;
}
data.attCardData.additionalInfo = options.sys_updated_on;
data.widgetData = $sp.getWidget("content-card", data.attCardData);
}
else {
if (!attSysId || !attTable)
return;
var gr = new GlideRecordSecure(attTable);
if (gr.get(attSysId)) {
data.attCardData.title = gr.getDisplayValue('file_name');
var description = gr.getDisplayValue('text');
data.attCardData.description = !description ? '' : $sp.stripHTML(description);
data.attCardData.image = gr.getDisplayValue('image') ? gr.getDisplayValue('image') + '?t=small' : '';
data.attCardData.url = '?id=kb_article&sysparm_article=' + gr.getValue('number');
if(topicId){
data.attCardData.url += '&topic_id='+topicId;
}
data.attCardData.additionalInfo = gr.getDisplayValue('sys_updated_on');
data.widgetData = $sp.getWidget("content-card", data.attCardData);
} else
return;
}
})();
Then change the portal page to display the customised widget.
The OOB widget is only setup for Catalog items and KB articles, so if it's not the attachments that is causing the issue. I would do a $scope.data dump on the Topic Content widget and check the console to see what is missing, you'll find the table under aisSearchResults
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2023 08:48 PM
@rachana_patel did my post clear on why this was happening and help you resolve this issue of the blank cards?