2

We are trying to add a validation on knowledge article before publishing. This can not be done with validation rule since it involves data category.

However, when I do that via trigger, I find that knowledge trigger doesn't even fire when we publish the article. Is there a walkaround for this?

2
  • Isn't it just the knowledge object itself you need to validate against?
    – Adrian Larson
    Commented Jan 24, 2022 at 0:41
  • @AdrianLarson Yes, we need to validate that the knowledge object need to have a data category before it can be published
    – Lance Shi
    Commented Jan 24, 2022 at 0:42

1 Answer 1

0

I'm dealing with a similar requirement; I was trying to avoid apex, but if you check this Idea https://ideas.salesforce.com/s/idea/a0B8W00000GdbROUAZ/allow-validation-rules-based-on-data-category-in-knowledge-articles you'll find someone who solved this by hiding the OOTB publish buttons and added their own screen flow component onto the Knowledge page that gives them the ability to run all the validation checks they want.

So my preferred solution is to implement checks which run when the article is published:

On the Lightning record page I have added a screen flow component with conditional visibility of Publication Status = Draft. I have removed the “Publish” button from the page layout.

The screen flow has option buttons for whether there should be a new version. When it runs, it first saves the article, which checks that all active validation rules are satisfied. (This is not part of Salesforce’s process when an article is published.) Next it creates a blank error variable. Then it checks for data categories and adds to the error variable if there are none. (More complex criteria can also be added.) Then it does other checks (in my case checking that the summary is not blank). Then if there are errors, these are output to the screen. If there are no errors, the article is published using either PUBLISH_ARTICLE_NEW_VERSION or PUBLISH_ARTICLE.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .