Header Ads Widget

Ticker

6/recent/ticker-posts

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 Model

With the assumption that you know Data Model quite well, let's dive in -

Edit Knowledge Article

From 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 below

Here 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 Article

Similar 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 below

Here are the parameters -
  • Article Version ID List - This is the list of article version ids. In your flow, you need to query and store the version ids in a collection and then use that collection here.
  • Publish Action - Possible values are  
    • PUBLISH_ARTICLE - This will replace the existing online article.
    • PUBLISH_ARTICLE_NEW_VERSION - This will create a new online version.
    • SCHEDULE_ARTICLE_FOR_PUBLICATION
    • PUBLISH_TRANSLATION
  • Schedule Publish Date - You can schedule the publication by entering future dates.


Other Knowledge Actions 

There are few other knowledge actions available to be used from the flow as well like -
  • Archive online knowledge articles
  • Delete Knowledge Articles
  • Restore archived knowledge article version
  • Submit Knowledge Article for Translation


Conclusion

As power comes with responsibilities, as a developer/admin, you need to keep in mind that not all Knowledge actions are bulkified. For example, editing knowledge articles as a draft is not bulkified. So if you try to edit many knowledge articles you will be presented with an error message. You need to find the threshold (Max # of articles you can edit as a draft using this action) and then within your flow, you need to make sure you are running a loop only for that threshold number only. 

You can read my earlier blog post which will show you how you can break the loop and make sure your loop within flow runs only for n number of times(not for the entire list).

How to update "N" records in Flow


Please provide your feedback in the comment section if you are using any other Knowledge actions within the flow.  





Post a Comment

2 Comments

  1. @Sudipta, thank you very much for writing this up! I'm running into some issues with the Article Version ID List for Publish. Would you please consider fleshing out that portion of your example a bit more, including detail in the step prior as well? Thanks!

    ReplyDelete
    Replies
    1. Hi Mia,

      You basically need to query the article and get the article version id and store that in Flow collection variable. I would suggest you go through the below post to understand the Knowledge Data Model - https://www.sudipta-deb.in/2020/09/understand-salesforce-lightning.html

      Delete