function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tarun Kaushik 11Tarun Kaushik 11 

unable to archieve published article

HI All

when we edit the published article ,It gives us two records of article one is with publishstatus='Draft' and other one is publishstatus='Published' with same values in all fields.
I want to archive the article with publishstatus='published' on the update of corresponding article publishstatus='Draft'.

I have tried it by invoking @invocable method  by process builder using below method of PublishingService Class,however i am getting below error

Error Occurred: An Apex error occurred: System.HandledException: 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.

String articleId = 'hard coded KnowledgeArticleId of articletype with publishstatus='Draft' ';
Datetime scheduledDate =NULL;
Method-KbManagement.PublishingService.archiveOnlineArticle(articleId,scheduledDate);

How can I achieve it..?

 
VineetKumarVineetKumar
Check the user permission for archiving, try my manually archiving the article with that user, and see the error there.
Tarun Kaushik 11Tarun Kaushik 11
HI

When I click on edit on published article ,It creates a new draf article and at that moment published 'Archive' button is invisble .
My requiremrnt is similar to this,I want to archive the published article on the update on the update of new draft article which was created after editing the man published article.?
VineetKumarVineetKumar
When you edit an existing article, a new version is automatically created, and the old version is already kind of archived, the old version will not show up on the search or when you try to open the article.
Archival done using the archive button, will archive the whole published article, irrespective of the versions.