Category: Knowledge

How to use Knowledge Actions in Lightning Flow

Recently while implementing Knowledge for one of my customers, I spend quite a good amount of time doing operations on Knowledge Articles through Flow. This post will focus on two highly used Knowledge Article operations i.e. Publish and Edit.Before I go into further details, I will highly recommend you go through the below post to understand the Knowledge Data Model. Understanding Knowledge Data Model is the key as it will help you to use these actions in flow effectively and correctly. Here is the post -Understanding Salesforce Lightning Knowledge Data ModelWith the assumption that you know Data Model quite well, let’s dive in -Edit Knowledge ArticleFrom Salesforce Flow, you can now edit the Knowledge article as a draft. To do that, you need to use the action and then “Create draft from online knowledge article” Knowledge article action as shown belowHere are the parameters -Action – The possible values are “EDIT_AS_DRAFT_ARTICLE” and “EDIT_AS_DRAFT_TRANSLATION”.Unpublish – “True” will archive the current published version and create a draft version. “False” will keep the current version published and create a new draft version.Article ID: Article Id of the master published article. A draft article will be created from this one.Publish Knowledge ArticleSimilar to the above from Salesforce Flow, you can now publish the Knowledge article. To do that, you need to use the action and then “Publish Knowledge Articles” Knowledge article action as shown belowHere...

Read More

Using Apex with Knowledge

 In continuation of my effort to make Lightning Knowledge easily understandable for all, today I am going to show how Salesforce Knowledge can be accessed using Apex. Salesforce Knowledge can have Apex Triggers and be accessible through Apex code. Actually, Salesforce provides some standard apex classes related to Knowledge Management that can be called for actions like publishing, editing as draft, archiving, and more.Before I start, I would recommend you going through my earlier posts -Understanding Salesforce Lightning Knowledge Data ModelHandy SOQL/SOSL Queries for KnowledgeWe can use the methods in KbManagement.PublishingService class to manage the lifecycle of an article. I am going to explain some of the few classes which developer needs mostly, but to know about all the methods, I highly recommend you going through the documentation here.Editing an Article as DraftWe can use the below method to edit an article as draft – String newId = KbManagement.PublishingService.editOnlineArticle(                    knowledgeArticleId,                     false               );Where the 1st input parameter is the KnowledgeArticleId (Note – This is not the Knowledge Record Id).2nd parameter is a Boolean value where false will not unpublish the already published articles and true will unpublish the already published article.This method will return the new draft master version ID of the article.Note – We need to keep this in mind that this method is not bulkified. So if...

Read More