Thursday, March 4, 2021

Publish knowledge articles with rest api in salesforce

Whenever you create an article in salesforce its publish status is 'draft' by default. You have to publish that article to make it 'online'. In this blog we will learn how to publish draft article in salesforce by Rest API with the help of workbench :

Publish Draft article :

Here I am publishing one draft article. As you can see there is one one draft article in my org.

Draft articles in salesforce


First you need to find articleVersionId of the article which you want to publish. To get the articleVersionIdList you have to query on the KnowledgeArticleVersion object.

"SELECT KnowledgeArticleId, Id, PublishStatus, Title, UrlName FROM KnowledgeArticleVersion"

soql to get knowledgeVersionId


Method :- Post
URL:- /services/data/v50.0/actions/standard/publishKnowledgeArticles

Request Body :-
                        {
                            "inputs" : [
                             {
                                "articleVersionIdList" : [ "ka02x000000WGbwAAG" ],
                                 "pubAction" : "PUBLISH_ARTICLE"
                             }
                             ]
                         }

 

If you want to mass publish articles, you have to give comma separated id's in articleVersionIdList value in the request body.

Publish knowledge articles with workbench

Article Published:-  After executing the rest service, you can see the article is published now.

published articles in salesforce

Thanks, 
Lovesalesforceyes


No comments:

Post a Comment

Get selected radio button value in LWC

This post explains how to get selected radio button in LWC. Below is demo of output : To use the radio button in LWC you have to use the  li...