I have some code that queries KnowledgeArticleVersions and I'm trying to test it. In order to do so, I first need to add articles...

public class ORC_TestUtils {

    public static void addPublishedArticle(){
            Issue__kav article= new Issue__kav(
            Title = generateRandomString(),
            UrlName = generateRandomString()
            insert article;
            //using object because all objects have the same properties
            KnowledgeArticleVersion a = [SELECT KnowledgeArticleId FROM KnowledgeArticleVersion WHERE Id = :(Id) article.get('id')];
            KbManagement.PublishingService.publishArticle(a.KnowledgeArticleId, true);


This seems to work fine when I test it in my sandbox, but when I try to validate in production, it fails with this message:

System.NoAccessException: Insufficient Privileges: You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.

I've tried using System.runAs() with a sys admin user but I get the same results... Anyone have any idea why this is happening?

  • Does your running user have the knowledge feature active?
    – Girbot
    Feb 20, 2015 at 8:45
  • @Girbot is that a specific setting in my user? as Opposed to the profile?
    – NSjonas
    Feb 20, 2015 at 8:58
  • yes it's a feature licence on the user record not profile. Sys admins don't have it by default
    – Girbot
    Feb 20, 2015 at 9:05
  • @Girbot Looks like that was it. Want to submit an official answer?
    – NSjonas
    Feb 20, 2015 at 9:20
  • Done, glad that sorted it :)
    – Girbot
    Feb 20, 2015 at 9:36

1 Answer 1


In order to be able to create and edit a Knowledge Article the running user needs the "Knowledge User" checkbox ticked on the user record. This is a feature licence that is not controlled currently within a profile and sys admin do not get the permission by default.

enter image description here

An explanation of the permissions required can be found at the link below. Note any user can now view Articles but the feature licence is required in order to create and/or edit:


You must log in to answer this question.

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