The Now Platform® Washington DC release is live. Watch now!
‎07-11-2016 12:07 AM
‎07-13-2016 09:40 AM
Hey Jeremy,
As Service Portal only allows you to connect to 1 Knowledge Base OOB, this would require a custom solution. If you navigate to Service Portal > Widgets > Search Page (and search nav)
if (data.t == 'kb' || !data.t) {
var kb = $sp.getKBRecord();
kb.addQuery('123TEXTQUERY321', data.q);
kb.setLimit(data.count);
kb.query();
data.article_count = kb.getRowCount();
while (kb.next()) {
// Does user have permission to see this item?
if (!$sp.canReadRecord("kb_knowledge", kb.getUniqueValue()))
continue;
var article = {};
$sp.getRecordDisplayValues(article, kb,
'sys_id,number,short_description,published,text')
article.type = "kb";
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());
data.results.push(article);
}
$sp.logSearch('kb_knowledge', data.q, kb.getRowCount());
}
Line 2 in my example shows we are using $sp.getKBRecord, this grabs that
field that drives the knowledge base you are using. This field exists on Service Portal > Portals > [Your Portal] > Knowledge Base field.
You could convert this to be a list field, then parse the array in the server script, loop through the results and add a glideRecord lookup.
Some other suggestions include:
I hope this helps point you in the right direction.
‎07-14-2016 11:25 PM
Thanks!!! 🙂
But i think it is very weird that you only can choose one knowledge base in the new Service Portal.
‎07-15-2016 05:33 AM
I understand completely that the 1:1 ratio between Service Portal and Knowledge Base can be frustrating. I am currently working on two solutions that I will post to share once they are complete:
Once these are complete, I'll reply to this thread. I'm hoping to be done over the next few days.
‎07-15-2016 05:52 PM
On a few of our portals we went through and update all the widgets to support all knowledge bases and all catalogs. It's actually quite a few widgets that need editing, and some of the widgets use server side API's that we do not have access to that need to be circumvented. Now the way it works is, if you specify a catalog it will use it, but if none is specified it will search and use all catalogs and knowledge bases. If you need any help or want to take a look how we did it, just shoot me an email and I'd be glad to help.