- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2016 02:56 AM
Hi,
I have created some 'Featured Content' for knowledge bases and when searching from the knowledge base homepage it pins it to the top of the results. This is great, but is there anyway to have this pinned to the top of the Contextual Search Results on the Incident form etc too?
Cheers,
Dan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2016 10:01 AM
If you are using the out of the box "incident deflection" Search Context, then system would render the pinned articles on the Contextual Search Results.
Basically you need to ensure that the Search Context that you are using, is associated with a Searcher that includes Pinned Knowledge articles.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2016 08:21 AM
Yes it is possible, with a bit of customization. I will ask Cameron to respond on his reply.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2016 08:34 AM
Appreciate it, Aditya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2016 01:03 PM
Hi Dan,
I've got something for you to try out. I assumed that you want to do something to the whole result row (tr) of a given pinned article. It doesn't make for the best CSS selector as there is no way to get the row directly. The code will iterate over all the pinned articles (they're always first) and break as soon as the source isn't "pinned".
Add the script bellow to your form as an onLoad client script. The event it observes is fired by Contextual Search whenever there is an update; that update could be results or no results.
Let me know how you get along.
function onLoad() {
document.observe("cxs:target_update", function() {
if (!NOW || !NOW.cxs_searchService || !NOW.cxs_searchService.response || !NOW.cxs_searchService.response.results)
return;
var results = NOW.cxs_searchService.response.results;
for (var i = 0; i < results.length; i++) {
if (!results[i].meta.pinned)
break;
var elem = $$(".cxs_result[data-index=" + i + "]")[0].up(".list_row");
elem.setStyle({
backgroundColor: "blue"
});
}
});
}
Thanks,
Cameron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2016 02:42 AM
Hi Cameron,
Thanks for taking the time to assist here.
When creating a new incident, I have added it as a onChange to the Short Description field and it works ok there.
When opening a current incident that has already been raised, it doesn't work there.
Any advice?
Thanks again,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2016 02:51 AM
Hey Dan,
Sorry....I realised that my response last night was only part of the solution. I was just editing it when you responded.
Have a look at it again and it should answer your question.