Update Knowledge Articles with Data Loader
|Knowledge Article Number||000233637|
|Description||It is possible to update knowledge articles using the Data Loader. The process involves:
1. Exporting articles
2. Manipulating your article's data externally
3. Performing an update
Note the following restrictions:
- It's only possible to update draft articles via the Data Loader and there are restrictions on how you can export or query knowledge articles.
- It's not possible to update an article's PublishStatus via the Data Loader and it's necessary set each article you would like to update to have a draft.
- There is no standard or supported means to mass update articles to draft status and they must be set to draft status one at a time via the user interface.
- You can only export and update one article type at a time. If you have multiple article types separate operations will be required for each.
For the more adventurous types, the Salesforce Knowledge Developer's Guide indicates that it may be possible to programmatically update knowledge articles but Salesforce does not offer a supported client tool that leverages the Knowledge APIs for an end to end out of the box solution for mass updating articles. You may be able to leverage the Apex Knowledge Management Publishing Service Class in order to set articles to draft, update them, and then re-publish but doing so would require the creation of a client tool to manage this overall process which is not supported.
To potentially help a developer get started leveraging the Knowledge API there is an informative Updating Knowledge Articles programmatically post on the discussion forums.
There is a Knowledge Heroku tool that includes the ability to update articles. More details are available in the Knowledge Import/Export Tools Success Community Group but please note that this tool is not officially supported by Salesforce.
In addition, you may consider exploring the potential use of the Salesforce Knowledge Global Search and Replace (Release 2.0) App however, again this tool is not supported either. See Support for third party apps, installed packages, or programs for more details.
|Resolution||1. Perform an Export:
- Open the Data Loader and select Export
- Select "Show all Salesforce objects" and select the appropriate ArticleType__kav object. Each article type has its own object available for selection substitute ArticleType with your desired article type's name to find its corresponding KnowledgeArticleVersion object.
- Click Browse... and choose a location and file name for the export's resulting .csv file | Next >
- Select your fields for export. Be sure to include Id and any of the desired standard or custom fields you would like to update
Note: There are query implementation restrictions when performing an Export via the Data Loader against the KnowledgeArticleVersion (ArticleType__kav) object. You must filter using the following syntax: Id = [single ID], Id IN [list of ID's] or PublishStatus = [status]. In addition PublishStatus is only permitted in a top-level AND condition or you will encounter the following error:
MALFORMED_QUERY: Implementation restriction: When querying or searching the Documentation__kav object, you must filter using the following syntax: Id = [single ID], Id IN [list of ID's] or PublishStatus = [status]. In addition PublishStatus is only permitted in a top-level AND condition.
You may add the following conditions to your query to satisfy the restrictions:
PublishStatus = Draft AND Language = 'en_US'
If your Knowledge base supports multiple languages you can find a list of available language codes for the Language condition in the documentation Which Languages Does Salesforce Support?
- Once you're satisfied with your field selection and have added the conditions as outlined above click Finish
2. Manipulate your resulting export file externally using an application of your choice:
If your articles contain rich text area (RTA) fields, the column for the field will contain the HTML code for the rich text field. See the Supported HTML Tags and Attributes section of the Using the HTML Editor documentation for a list of compatible HTML tags.
As an example, say that you need to update hard references to embedded image URLs in your knowledge articles and your resulting export file's custom RTA field HTML for an example image is:
<img alt="Launch" src="https://c.<YourOldInstanceHere>.content.force.com/servlet/servlet.ImageServer?id=015a0000003AlU7&oid=00Da0000001aQGp"></img>
To do so you could use Excel's find and replace function to search for "https://c.<YourOldInstanceHere>.content.force.com" and replace it with your new instance to update the references to the previous instance in all occurrences of URLs within your article's fields:
<img alt="Launch" src="https://c.<YourNewInstanceHere>.content.force.com/servlet/servlet.ImageServer?id=015a0000003AlU7&oid=00Da0000001aQGp"></img>
This example would be particularly helpful if your organization has been included in an instance split or migration to ensure your knowledge article images remain visible.
3. Perform an update:
- Open the Data Loader and select Update
- Select "Show all Salesforce objects" and select the appropriate ArticleType__kav object where ArticleType is the article's article type name.
- Click Browse... and choose your updated file that you prepared externally in step 2. | Open | Next > | Ok
- Click Create or Edit a Map and either select "Auto-Match Fields to Columns" or manually map the Id field and the fields that you're updating | Ok. Verify the mapping looks good and click Next >
- Click Browse... and choose a location to save the success and error files | Finish
- Review the Warning and if you're ready to proceed, click "Yes"
Idea: Mass Upload to Knowledge
SOAP API Developer's Guide KnowledgeArticleVersion
Idea: Mass edit published articles