Saturday, April 7, 2018

Lightning Knowledge Promoted Terms in Spring'18

I've been working on migrating our current Service Console from Classic to Lightning and although Salesforce has been adding new features to Lightning, I continue to run into parity issues. As of Spring '18 there are still key features that are not yet available in Lightning Knowledge. One of these key features is the use of Promoted Search Terms. One of the ways that we help our agents find knowledge articles is to use Promoted Search Terms to promote articles in the search results. This has worked well in Classic, but thus far this feature is not available in Lightning. To bridge the gap, I've created a Lightning App that let's the knowledge admins add Promoted Terms to existing articles. The APEX code to do just that is surprisingly simple.


Let's take a closer look at the code. After selecting the article by Id, we create a new instance of a SearchPromotionRule where we provide the search term (Query='Trailblazer') and the article Id to promote (PromotedEntityId=articles[0].Id);). The last line simply inserts the record. That's pretty much all there is to it.

A couple of things to note:
  • The user must have the "Manage Promoted Search Terms" permission.
  • The search term can be a maximum of 100 characters.
  • A search term can be associated with multiple articles.


Create a Lightning Component that Utilizes the Native Salesforce Global Search

I was recently working on a project where I needed to create Lightning Component that utilized the native global search to return items from...