Knowledge Actions
The Assign and Publish actions are available in API version 44.0 and later. All the other actions are available in API version 45.0 and later.
Lightning Knowledge must be set up in your org. The user must have permissions to manage articles.
You can use multiple inputs to an invocable action. This technique is useful for actions that don’t take lists, such as restoreKnowledgeArticleVersion.
Supported REST HTTP Methods
- URIs
- Archive Knowledge articles:
- /services/data/vXX.X/actions/standard/archiveKnowledgeArticles
- Assign Knowledge articles:
- /services/data/vXX.X/actions/standard/assignKnowledgeArticles
- Create draft from online Knowledge articles:
- /services/data/vXX.X/actions/standard/createDraftFromOnlineKnowledgeArticle
- Delete Knowledge articles:
- /services/data/vXX.X/actions/standard/deleteKnowledgeArticles
- Publish Knowledge articles:
- /services/data/vXX.X/actions/standard/publishKnowledgeArticles
- Restore Knowledge article version:
- /services/data/vXX.X/actions/standard/restoreKnowledgeArticleVersion
- Retrieve Smart Link URL:
- /services/data/vXX.X/actions/standard/getArticleSmartLinkUrl
- Submit Knowledge article for translation:
- /services/data/vXX.X/actions/standard/submitKnowledgeArticleForTranslation
- Formats
- JSON, XML
- HTTP Methods
- GET, HEAD, POST
- Authentication
- Authorization: Bearer token
- Other Information
- Error Response Types
Archive Knowledge Articles
URI: /services/data/vXX.X/actions/standard/archiveKnowledgeArticles
Input | Details |
---|---|
articleVersionIdList |
|
- Sample Input
-
The following code sample archives two articles:
{ "inputs" : [ { "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ] } ] }
- Sample Output
-
The following code sample illustrates a response after a successful request.
[ { "actionName" : "archiveKnowledgeArticles", "errors" : null, "isSuccess" : true, "outputValues" : { "ka0RM00000004Ve" : "Success", "ka0RM00000003do" : "Success" } } ]
-
The following code sample illustrates a response with one success and one failure:
[ { "actionName" : "archiveKnowledgeArticles", "errors" : null, "isSuccess" : false, "outputValues" : { "ka0RM00000004Ve" : "You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.", "ka0RM00000003do" : "Success" } } ]
Assign Knowledge Articles
URI: /services/data/vXX.X/actions/standard/assignKnowledgeArticles
Input | Details |
---|---|
articleVersionIdList |
|
assigneeId |
|
assignAction |
|
dueDate |
|
instruction |
|
sendEmailNotification |
|
- Sample Input
-
The following code sample assigns two articles for translation:
{ "inputs" : [ { "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ] "assigneeId" : "005RM00000AAAAAYA4", "assignAction" : "ASSIGN_DRAFT_TRANSLATION" } ] }
- Sample Output
-
The following code sample illustrates a response after a successful request.
[ { "actionName" : "assignKnowledgeArticles", "errors" : null, "isSuccess" : true, "outputValues" : { "ka0RM00000004Ve" : "Success", "ka0RM00000003do" : "Success" } } ]
Create Draft from Online Knowledge Article
URI: /services/data/vXX.X/actions/standard/createDraftFromOnlineKnowledgeArticle
Input | Details |
---|---|
action |
|
unpublish |
|
articleVersionId |
|
articleId |
|
- Sample Input
-
The following code sample creates a draft from a primary article and archives the original article:
{ "inputs" : [ { "action" : "EDIT_AS_DRAFT_ARTICLE", "unpublish" : true, "articleId" : "kA0RM00000004pP0AQ" } ] }
- Sample Output
-
The following code sample illustrates a response after a successful request.
[ { "actionName" : "createDraftFromOnlineKnowledgeArticle", "errors" : null, "isSuccess" : true, "outputValues" : { "kA0RM00000004pP0AQ" : "Success" } } ]
Delete Knowledge Articles
URI: /services/data/vXX.X/actions/standard/deleteKnowledgeArticles
Input | Details |
---|---|
articleVersionIdList |
|
- Sample Input
-
The following code sample deletes two articles:
{ "inputs" : [ { "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ] } ] }
- Sample Output
-
The following code sample illustrates a response after a successful request.
[ { "actionName" : "deleteKnowledgeArticles", "errors" : null, "isSuccess" : true, "outputValues" : { "ka0RM00000004Ve" : "Success", "ka0RM00000003do" : "Success" } } ]
Publish Knowledge Articles
URI: /services/data/vXX.X/actions/standard/publishKnowledgeArticles
Input | Details |
---|---|
articleVersionIdList |
|
pubAction |
|
pubDate |
|
- Sample Input
-
The following code sample publishes two articles:
{ "inputs" : [ { "articleVersionIdList" : [ "ka0RM00000004VeYAI", "ka0RM00000003doYAA" ], "pubAction" : "PUBLISH_ARTICLE" } ] }
- Sample Output
-
The following code sample illustrates a response after a successful request.
[ { "actionName" : "publishKnowledgeArticles", "errors" : null, "isSuccess" : true, "outputValues" : { "ka0RM00000004Ve" : "Success", "ka0RM00000003do" : "Success" } } ]
Restore Knowledge Article Version
URI: /services/data/vXX.X/actions/standard/restoreKnowledgeArticleVersion
Input | Details |
---|---|
action |
|
articleId |
|
versionNumber |
|
- Sample Input
-
The following code restores the latest archived version:
{ "inputs" : [ { "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION", "articleId" : "kA0RM00000004pP0AQ" } ] }
-
The following code restores a past archived version of a published article:
{ "inputs" : [ { "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION", "versionNumber":3, "articleId" : "kA0RM00000004pP0AQ" } ] }
-
The following code restores two archived articles:
{ "inputs" : [ { "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION", "articleId" : "kA0RM00000004pP0AQ" }, { "action" : "RESTORE_KNOWLEDGE_ARTICLE_VERSION", "articleId" : "kA0RM00000004pP0AB" } ] }
- Sample Output
-
The following code sample illustrates a response after a successful request.
[ { "actionName" : "restoreKnowledgeArticleVersion", "errors" : null, "isSuccess" : true, "outputValues" : { "kA0RM00000004pP0AQ" : "Success" } } ]
Retrieve Smart Link URL
URI: /services/data/vXX.X/actions/standard/getArticleSmartLinkUrl
Input | Details |
---|---|
articleVersionId |
|
- Sample Input
-
The following code sample retrieves the SmartLink URL of a Knowledge article version:
{ "inputs":[ { "articleVersionId":"ka0xx00000000cjAAA" } ] }
- Sample Output
-
The following code sample illustrates a response after a successful request.
[ { "actionName":"getArticleSmartLinkUrl", "errors":null, "isSuccess":true, "outputValues":{ "articleSmartLinkUrl":"https://example.lightning.force.com/lightning/articles/Knowledge/Test-Redirection-1" } } ]
Submit Knowledge Article for Translation
URI: /services/data/vXX.X/actions/standard/submitKnowledgeArticleForTranslation
Input | Details |
---|---|
articleId |
|
language |
|
assigneeId |
|
dueDate |
|
sendEmailNotification |
|
Output | Details |
---|---|
articleId |
|
language |
|
- Sample Input
-
The following code sample submits one article for translation into Spanish:
{ "inputs" : [ { "articleId" : "kA0RM00000004pP0AQ", "language" : "es", "assigneeId" : "005RM00000AAAAAYA4" } ] }
- Sample Output
-
The following code sample illustrates a response after a successful request.
[ { "actionName" : "submitKnowledgeArticleForTranslation", "errors" : null, "isSuccess" : true, "outputValues" : { "articleId" : "kA0RM00000004pP0AQ", "language" : "es" } } ]
Error Response Types
Knowledge actions can respond with two types of error responses: action-scoped errors and item-scoped errors.
Action-scoped errors describe an error about the overall action that you’re trying to invoke. Action-scoped errors have a statusCode in addition to a message. This example illustrates an action-scoped error caused by sending invalid input values.
[ {
"actionName" : "restoreKnowledgeArticleVersion",
"errors" : [ {
"statusCode" : "INVALID_API_INPUT",
"message" : "You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.",
"fields" : [ ]
} ],
"isSuccess" : false,
"outputValues" : null
} ]
Item-scoped errors describe a problem with a specific article or article version within the action. For example, this code illustrates an archiveKnowledgeArticles action response with one failed item and one successful item.
[ {
"actionName" : "archiveKnowledgeArticles",
"errors" : null,
"isSuccess" : false,
"outputValues" : {
"ka0RM00000004Ve" : "You can't perform this action. Be sure the action is valid for the current state of the article, and that you have permission to perform it.",
"ka0RM00000003do" : "Success"
}
} ]
If any type of error occurs with an action, the isSuccess field is false.