You need to sign in to do that
Don't have an account?
Shraddha Aher
Getting error : System.QueryException: Insufficient access rights: you cannot access draft articles.
Hi,
I am getting following error when I run my test class:
System.QueryException: Insufficient access rights: you cannot access draft articles.
The line for which it gives error is:
String q = 'select ' +pkb_Controller.join(pkb_Controller.kavFields, ',')+ ' from KnowledgeArticleVersion where Id = \'' +kavObj.get('Id')+ '\' and PublishStatus = :publishStatus';
kavObj = (KnowledgeArticleVersion)Database.query(q);
here I am trying to query the 'KnowledgeArticleVersion' object and I am getting the error.
How to give access for this object ? I am system administrator so should have the access by default.
I am getting following error when I run my test class:
System.QueryException: Insufficient access rights: you cannot access draft articles.
The line for which it gives error is:
String q = 'select ' +pkb_Controller.join(pkb_Controller.kavFields, ',')+ ' from KnowledgeArticleVersion where Id = \'' +kavObj.get('Id')+ '\' and PublishStatus = :publishStatus';
kavObj = (KnowledgeArticleVersion)Database.query(q);
here I am trying to query the 'KnowledgeArticleVersion' object and I am getting the error.
How to give access for this object ? I am system administrator so should have the access by default.
If you don't have access to the object, go to system admin profile and give read , edit permission on this object.
And its just a suggesstion, why you are querying database records in the test class, its not good for practice.
For more detail about test class go for this post : http://abhithetechknight.blogspot.in/2013/10/salesforce-test-class-basics.html
Regards,
Abhi Tripathi
Salesforce Certified Developer
A user must have the “Manage Articles” permission enabled to use Online. 'Manage Articles'
Kindly check "Knowledge User" check box is checked on your user detail page.
If this solves your problem, kindly mark it as the best answer.
Hit Like, if it saved your work :-)
Regards,
Magulan
http://www.infallibletechie.com