11 votes
Accepted

SOSL not returning any result in Test class

Just as @Eric commented out: You need to place searched object id into Test.setFixedSearchResults So in your case: Id [] fixedSearchResults= new Id[1]; fixedSearchResults[0] = objKav.Id; Test....
user1974566's user avatar
  • 2,315
8 votes
Accepted

System.AsyncException: The Apex job named "Scheduled Job0" is already scheduled for execution

Its basically the issue with the scheduled job names. When Scheduled Job2 is running and trying to scheduled next set of Scheduled job its finding that a job named Scheduled Job0 is already running or ...
Avijit Das's user avatar
  • 1,416
8 votes

Dynamic casting in apex

Please note that SObject and Object are very different types. And adding [] at the end of your type definition makes it a List, again a huge difference. The text of your post indicates you meant ...
Adrian Larson's user avatar
  • 150k
7 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 '%...
phani dev's user avatar
7 votes

How to use drag and drop in visualforce

Here's a simple drag-drop example written in pure Visualforce: <apex:page controller="DragDrop"> <script> var dragStartId; function cancel(event) { event.preventDefault(); ...
sfdcfox's user avatar
  • 491k
6 votes
Accepted

How to query for articles without a data category?

I know this is an old question, but I ran into the same problem today, and solved it like this: Select Id, ArticleNumber, Title from ArticleType__kav where Id not in (Select ParentId from ...
koma's user avatar
  • 96
5 votes
Accepted

Mass updating published articles

This method creates draft articles from online articles, so this happens because one or more of those online article already has a draft article so you cannot create another draft article(you cannot ...
PepeFloyd's user avatar
  • 8,001
5 votes
Accepted

Publishing Article in Test Class

The method KbManagement.PublishingService.publishArticle(articleId, true) needs a KnowledgeArticle Id. What you are trying to do is giving the KnowledgeArticleVersion Id to the method. You can see the ...
Folkert's user avatar
  • 2,702
5 votes
Accepted

How to assign data categories to articles using apex controller?

You might be getting this error based on DataCategoryName, not DataCategoryGroupName. Double-check that Latin America is a valid category for the category group you selected based on results[0].
Adrian Larson's user avatar
  • 150k
5 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 : ...
sfdc_sk's user avatar
  • 179
5 votes
Accepted

Preventing downloading files from Community for particular users

You can take a look at ContentDownloadHandlerFactory and ContentDownloadHandler to implement your own custom solution. When a download is triggered either from the UI, Connect API, or an sObject call ...
Oleh Berehovskyi's user avatar
5 votes

SFDX Tree Export only exports 200 records

You need to use --plan to get more records out. If you don't have a plan, you're technically limited to the REST API that powers importing. It's limited to 200 records across all trees, so to import ...
sfdcfox's user avatar
  • 491k
5 votes
Accepted

Passing variables from flow to apex and then from apex to flow

To create an input and output from flow to apex or vice versa, you will need to ensure you annotate them as @InvocableVariable. To make your apex method available as an action, annotate the method ...
Mohith Shrivastava's user avatar
4 votes

SOQL Query Knowledge Article by Lookup Field Object ID

If you check out the salesforce documentation you must: When ObjectTypeName equals to KnowledgeArticleVersion or any article type API Name in the FROM clause, a WHERE clause must be specified with ...
brovasi's user avatar
  • 5,655
4 votes
Accepted

How to retrieve languages in which a Knowledge Article is translated

A way to fetch what other languages it has been translated to is to filter on the knowledgearticleid or Id in your soql. As per the SOAP API Developer Guide documentation on KnowledgeArticleVersion: ...
glls's user avatar
  • 20.1k
4 votes

Dynamic casting in apex

Apex doesn't really have much in the way of reflection or introspection. While we do have the Type class (which has the forName() method), you still need to know the name of the object at compile ...
Derek F's user avatar
  • 61.5k
4 votes
Accepted

approve article before publish

Knowledge Article object is very special object - you can not track changes of PublishStatus field in trigger/process builder. As workaround (not very good solution) - Remove "Publish" button from ...
Ayub's user avatar
  • 3,503
4 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 ...
Kris Goncalves's user avatar
4 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 ...
Anmol Kumar's user avatar
  • 3,629
4 votes

Upsert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION Invalid vote type '5-star(db=6,api=5)'

For the lightning Knowledge base the Vote type will be 1 to 5. For the classic KB the vote type is UP or Down. If you are using lightning disable the option 'Enable thumbs up or down voting for ...
Vinod's user avatar
  • 65
3 votes

How to describe Knowledge category object for sub categories

Yes you can get all the child level categories. i have already done to get all the levels of category using the following code. public List<DescribeDataCategoryGroupStructureResult> ...
Hitesh Gupta's user avatar
3 votes
Accepted

Override knowledge auto suggest

You can use controller extension of ApexPages.KnowledgeArticleVersionStandardController as follows: public class AgentContributionArticleController{ // The constructor must take a ApexPages....
Santanu Boral's user avatar
3 votes

Create/Edit or Update a knowledge article in Salesforce using apex code

I know that it was a few years ago, but here is my code snippet for future usage. I used publishArticle(articleId, flagAsNew) and editOnlineArticle(articleId, unpublish). You can find more details on ...
Piotr Gajek's user avatar
  • 2,625
3 votes

How to find Knowledge Article Type?

5 years later and this data is now exposed on the KnowledgeArticleVersion table itself. https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/...
a_sdfc_developer's user avatar
3 votes

Salesforce Knowledge || Can we use JavaScript or jQuery functions in Text (rich) data type?

No, you can't include JS code in Rich Text Fields. The whole purpose of this field type is to strip out active content such as Javascript. Part of the contract of the Rich Text Field type is that it ...
Robert Sussland's user avatar
3 votes
Accepted

Knowledge article not displaying body

By default, the only standard fields provided on article types are: Article Number, Summary, Title, and URL Name. If you want other fields, like a rich text area to hold some kind of information, you ...
Paul H.'s user avatar
  • 1,338
3 votes
Accepted

KbManagement.PublishingService.publishArticle not working

The article will have the online status (i.e. published). The reason why you are getting a draft status, is because you are still retrieving the status that you fetched from the initial query. After ...
Santanu Boral's user avatar
3 votes

Salesforce Crm content general questions

First of all, from the screenshot you provided it looks like you are looking for Salesforce for Non-profit organization (free first 10 licenses and discounted after). In regard of your questions 1&...
o-lexi's user avatar
  • 3,094
3 votes

How to get all the deleted Knowledge Article in Salesforce

This is really weird, maybe salesforce is storing deleted article somewhere else. With following query, it shows the deleted KnowledgeArticle's: SELECT Id, ArticleNumber, ArchivedById, ArchivedDate ...
Raul's user avatar
  • 18.8k
3 votes
Accepted

force:createRecord for Article type

Looks like lightning knowledge needs to be enabled for this functionality to work. Functionality was added with Spring '17 and is documented here Here’s how to move to Lightning Knowledge. Make ...
glls's user avatar
  • 20.1k

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