50 votes
Accepted

Assigning permission set to user in apex

Turns out it's very easy: PermissionSetAssignment psa = new PermissionSetAssignment (PermissionSetId = myPermissionSetId, AssigneeId = myAssigneeId); insert psa;
  • 9,687
6 votes

Assigning permission set to user in apex

List<PermissionSetAssignment> permissionSetList = new List<PermissionSetAssignment>(); for (User u : [SELECT ID,UserRole.Name,Profile.Name,IsActive FROM User WHERE UserRole.Name LIKE '%...
4 votes
Accepted

Unable to publish knowledge article in apex test class

Try to pass KnowledgeArticleId of your Article knowledge__kav. You might need to again retrieve the article record you have inserted and then Pass KnowledgeArticleId. In your case it will be : ...
  • 169
4 votes

LWC is not showing up in Record page for Knowledge Record Page

We built something similar in the past, and we had to modify the component's configuration file as follow: Set isExposed to true, to allow the component to be used in Lightning App Builder, Define ...
4 votes
Accepted

Automatically Publish Knowledge Article

KbManagement.PublishingService.publishArticle is supported for both classic as well as lightning. You need to pass the Knowledge__kav.KnowledgeArticleId field to it and not Knowledge__kav.Id. Sample ...
  • 3,339
4 votes
Accepted

Get Suggested Articles in apex

The Search Class has the following method suggest(searchQuery, sObjectType, suggestions which can be used If the searchQuery returns KnowledgeArticleVersion objects, pass an options parameter with a ...
3 votes

How to retrieve Data Category Group Visibility on Profiles, Permission Sets and Roles?

Data category visibility information is stored in the profile and permission set. Visibility information can only be retrieved using Profile(Permission set does not support category visibility ...
  • 3,339
3 votes
Accepted

Knowledge Article Not Copying Related Custom Object Record when in Draft Mode

Yes, this is the standard behavior Child objects are linked to the knowledge article version. You can maintain consistency by store Knowledge Article Id(Formula field) on the child object A ...
  • 3,339
3 votes
Accepted

Where does like & dislikes stores when we give knowledge article feedback

I'll break this up as I answered a different couple things for inserting a vote in apex, pulling the vote stats for an article, and for getting a normalized score of the article votes. Insert a vote ...
3 votes
Accepted

Knowledge Article Suggestions: behavior differs between Classic and Lightning

In the lightning mode "Knowledge One" component is used and that's why "Knowledge One" component is showing at your first picture. In the second picture, you are using primitive version of Article ...
3 votes
Accepted

Knowledge Article Version (Knowledge__kav) query returns only articles with the same language as current user

The default is en_US (or whatever the users setting is), if you want to retrieve articles in some other language, you will have to specify it in your query Always filter on a single value of ...
  • 19.6k
3 votes
Accepted

Rest callout via Batch Apex throws invalid session Id error

The session id that you get back from UserInfo.getSessionId() is not valid from batch code. This is actually due to be changed in the Winter 19 release: API calls sometimes require a session ID and ...
  • 13k
3 votes

How to Retrieve Knowledge Validation Status Picklist custom values?

Oddly enough if you create one in a scratch org it will be tracked as a StandardValueSet, but does not work with a metadata retrieve from a standard sandbox. === Source Status STATE FULL NAME ...
3 votes
Accepted

Unable to Set CreatedDate only on Knowledge__kav

The knowledge article Considerations and activation of 'Create Audit Fields' has a list of objects that are available for these kinds of updates, and unfortunately Knowledge Article isn't one of them. ...
3 votes
Accepted

Object Prefix - Third Character

If you're familiar with the Dewey Decimal System (used to categories books in libraries), this conversation will feel familiar. For the most part, Salesforce uses the three prefix characters as a ...
  • 451k
2 votes
Accepted

Knowledge tab in Salesforce Lightning

The knowledge tab(s) (for classic knowledge) are not Available in lightning, you still have to switch to classic to have access them. Unless you have enabled lightning knowledge, then you will be ...
  • 19.6k
2 votes

Can't enable Salesforce Knowledge in my sandbox

You can find knowledge user checkbox in user record like below image. Also check feature licenses under company information:
  • 3,901
2 votes

can the end user can view the knowledge articles published in the sales force? without the checkbox enabled in the user settings?

Simple answer is Yes. If you intend to use your community as a public knowledge base for unauthenticated (or guest) users, you can do so without purchasing communities licenses. For example, guest ...
2 votes

Public Knowledge Base for Lightning Knowledge

This is the purpose of the Help Center Community template. There is no additional charge for this community as the cost of communities comes from logins. So, if it is public only there is no charge. "...
  • 21
2 votes
Accepted

Enable Multiple Languages via knowledgeSettings in Scratch Org Definition File

Managed to figure out the correct JSON structure. language needs to be an array within languages field. { "orgName": "knowledge_dev", "edition": "Enterprise", "country": "US", "language": "...
  • 5,363
2 votes

Unable to publish knowledge article in apex test class

I created a code snippet for future use. More details here. Code contains the following methods: getAllArticles createNewArticleAsADraft publishArticle unPublishArticle ...
  • 1,857
2 votes
Accepted

Bulk Upload Attachments into Lightning Knowledge Articles

Unfortunately, I don't think you can do this in one load. ContentDocumentLink is what you need to insert that'll have a lookup to the file and the Knowledge Article. Both of those records need to ...
2 votes

How to get Sum of Knowledge Article Thumbs Up and Down Votes based on Role / Profile

You can not categorize knowledge articles on the basis of profiles as KnowledgeArticleVoteStat only stores channel and normalized score for an article. However, You can use the Knowledge Base ...
  • 3,339
2 votes

Notification after Knowledge Article is Published

Looks like this limitation is clearly documented. One workaround would be to maintain a custom field (may be a picklist or a Boolean ) and trigger off based on that and publish an article based on ...
2 votes

SOQL Knowledge Search Activity

You can use SearchActivity object to perform a SOQL. Below is the sample query. You can modify the query as per your requirement. . SELECT Id,SearchTerm FROM SearchActivity Refer documentation here. ...
  • 2,674
1 vote
Accepted

Update Vote of KnowledgeArticle With API

As I didn't get answer from any source or documentation from Salesforce. I have raised a ticket with Salesforce Service Team. Salesforce Team informed me that Salesforce do not provide the provision ...
1 vote

Knowledge Article Not Copying Related Custom Object Record when in Draft Mode

We've had discussions with Salesforce and checked with the product team about this and they let us know this is by design and will not be changing. The reason for that has to do with the Knowledge ...
1 vote
Accepted

Articles not displaying in Lightning Community

As an update regarding this question, I opened a case with salesforce regarding this and got a response that way. The issue was that our community was created with the language English (US) and at ...
1 vote

How to create a custom lightning web component for Knowledge Articles to show article title and article body only?

The lightning data service does not support the Knowledge__kav object as per the User Interface API guide. It is supported in Lightning communities container but your object is not supported. Hence, ...
  • 13.9k

Only top scored, non community-wiki answers of a minimum length are eligible