- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 08:37 AM
Q1)Service Portal Search selection should group knowledge articles and catalog items separate it displays all together now.Is there any way to group them in typeahead search PFA.
Q2) Can any suggest me on how to label Knowledge Article on header and show list of articles below that and similar to label service catalog and catalog list below that .Rather then displaying knowledge article and service catalog for each entry.
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- 7,952 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2017 11:14 AM
Thanks for your response i found solution by making some script changes and it worked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-26-2017 05:31 PM
Hi Santosh,
I was just exploring this change and I found few places where you can modify and get exact same result but I am not sure about the best way to do this, so do it at your risk
Steps:
1. Open your custom service portal.
2. Goto Search Sources and open Service Catalog & Knowledge Base records
3. In Service Catalog record, add <strong>Service Catalog: </strong> in Typeahead form section.
4. Now open Knowledge Base - Search Source record and add article.kb_title = "Knowledge Base: "; at line number 23 ( as described in below screenshot)
5. Open "sp-typeahead.html" Angular Template and add "<strong ng-if="match.model.kb_title">{{match.model.kb_title}}</strong>"
URL : https://instance_name.service-now.com/sp_ng_template_list.do?sysparm_query=id%3Dsp-typeahead.html
That's it and the result :
Note: Please test in your personal dev. instance before implementing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2017 11:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2017 02:05 PM
Hi Santosh,
can you please provide steps how you have done? it would be helpful to me
Thanks
nayeem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 12:35 PM
(function() {
var order = 0;// ordering articles and catalog
data.searchType = $sp.getParameter("t");
data.results = [];
data.searchMsg = gs.getMessage("Search");
data.limit = options.limit || 15;
var textQuery = '123TEXTQUERY321';
if (!input)
return;
data.q = input.q;
getKnowledge();
if (gs.isLoggedIn())
getCatalogItems();
data.sqandaEnabled = gs.getProperty('glide.sp.socialqa.enabled', false) === 'true';
if (data.sqandaEnabled)
getQuestions();
// add in additional search tables from sp_search_groups
var portalGR = $sp.getPortalRecord();
var portalID = portalGR.getDisplayValue('sys_id');
var sg = GlideRecord('sp_search_group');
sg.addQuery('sp_portal',portalID);
sg.addQuery('active',true);
sg.orderBy('order');
sg.query();
while (sg.next())
addSearchTable(sg);
// typeahead search generates multiple "Your text query contained only
// common words..." msgs, we don't want them
gs.flushMessages();
function addSearchTable(sg) {
var table = sg.getValue('name');
var condition = sg.getValue('condition');
var gr = GlideRecord(table);
if (condition)
gr.addEncodedQuery(condition);
gr.addQuery(textQuery, data.q);
gr.query();
var searchTableCount = 10; // serach count
var header = {}; // begin header label for catalog and article
header.type="header";
header.label = "<h4>"+sg.tables.getDisplayValue()+"</h4>";
header.score = 0;
header.order=order;
header.text= sg.tables.getDisplayValue();
data.results.push(header);
order++; // end
while (gr.next() && searchTableCount < data.limit) {
var rec = {};
rec.type = "rec";
rec.table = table;
rec.sys_id = gr.getDisplayValue('sys_id');
rec.page = sg.getDisplayValue('sp_page');
if (!rec.page)
rec.page = "form";
rec.label = "<b>"+table+"</b> "+gr.getDisplayValue(); // displaying label
rec.score = parseInt(gr.ir_query_score.getDisplayValue());
rec.order=order; // order begin
data.results.push(rec);
searchTableCount++;
order++; // order end
}
}
function getKnowledge() {
var kb = new GlideRecord('kb_knowledge');
kb.addQuery('workflow_state', 'published');
kb.addQuery('valid_to', '>=', (new GlideDate()).getLocalDate().getValue());
kb.addQuery(textQuery, data.q);
kb.addQuery('kb_knowledge_base', $sp.getDisplayValue('kb_knowledge_base'));
kb.query();
var kbCount = 10; // count list
var header = {}; // begin header label for article
header.type="header";
header.label = "<h4>Knowledge Article</h4>";
header.score = 10;
header.order=order;
header.text= "Knowledge Article";
data.results.push(header);
order++; //order end
while (kb.next() && kbCount < data.limit) {
if (!$sp.canReadRecord(kb))
continue;
var article = {};
article.type = "kb";
$sp.getRecordDisplayValues(article, kb, 'sys_id,number,short_description,description,picture,published,text');
if (!article.text)
article.text = "";
article.text = $sp.stripHTML(article.text);
article.text = article.text.substring(0,200);
article.score = parseInt(kb.ir_query_score.getDisplayValue());
article.label = "<b>Knowledge Article</b> " +article.short_description; // highlight KB in bold fornt of KB article
article.order=order; // order begin
data.results.push(article);
kbCount++;
order++; // order ends
}
}
function getCatalogItems() {
var sc = new GlideRecord('sc_cat_item');
sc.addQuery(textQuery, data.q);
sc.addQuery('active',true);
sc.addQuery('no_search', '!=', true);
sc.addQuery('visible_standalone', true);
sc.addQuery('sys_class_name', 'NOT IN', 'sc_cat_item_wizard');
sc.addQuery('sc_catalogs', $sp.getValue('sc_catalog'));
sc.query();
var catCount = 10;// limit the search to 5
var header = {}; // begin of header and label for catalog
header.type="header";
header.label = "<h4>Service Catalog</h4>";
header.score = 10;
header.order=order;
header.text= "Service Catalog";
data.results.push(header);
order++;
while (sc.next() && catCount < data.limit) {
if (!$sp.canReadRecord(sc))
continue;
var item = {};
if (sc.getRecordClassName() == "sc_cat_item_guide")
item.type = "sc_guide";
else if (sc.getRecordClassName() == "sc_cat_item_content") {
var gr = new GlideRecord('sc_cat_item_content');
gr.get(sc.getUniqueValue());
$sp.getRecordValues(item, gr, 'url,content_type,kb_article');
item.type = "sc_content";
}
else
item.type = "sc";
$sp.getRecordDisplayValues(item, sc, 'name,short_description,description,picture,price,sys_id');
item.score = parseInt(sc.ir_query_score.getDisplayValue());
item.order=order; //order begin
item.label = item.name;// highlight SC in bold infront of catlog name ("Service Catalog "+)
data.results.push(item);
catCount++;
order++; // order ends
}
}
function getQuestions() {
var questionGR = new GlideRecord("kb_social_qa_question");
questionGR.addActiveQuery();
questionGR.addQuery(textQuery, data.q);
questionGR.query();
var qCount = 0;
var header = {}; // begin of header for questions
header.type="header";
header.label = "<h4>Questions</h4>";
header.score = 0;
header.order=order;
header.text= "Questions";
data.results.push(header);
order++;
while (questionGR.next() && qCount < data.limit) {
if(!$sp.canReadRecord(questionGR))
continue;
var question = {};
question.type = "qa";
$sp.getRecordDisplayValues(question, questionGR, 'question,question_details,sys_created_on,sys_id');
question.text = (question.question_details) ? $sp.stripHTML(question.question_details) : "";
question.text = question.text.substring(0,200);
question.label = "<b>Question</b> "+question.question;
question.score = 0;
question.order=order; //order begin
data.results.push(question);
qCount++;
order++; // order ends
}
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 12:46 PM
Thank you so much....