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
SFDCmack08180939826349907SFDCmack08180939826349907 

Hey I am trying to delete an KB article from a button I have developed the code but its not work

  I get an unexpected token: 'execute' in line 3 any know what I am doing wrong?

Public class KBDelete{
    
    public static void PageReference execute(){
           Id id = ApexPages.currentPage().getParameters().get('id');
        String articleId = 'id';
           
     KbManagement.PublishingService.archiveOnlineArticle(articleId, null);

  
}
           
   
                                                             }

Visualforce 
<apex:commandButton value="Delete" action="{!execute}"></apex:outputLink></apex:commandButton>
hitesh90hitesh90
Hello,

You need to modify your controller code as below.

Apex Class:
Public class KBDelete{
    public static void execute(){
        Id id = ApexPages.currentPage().getParameters().get('id');
        String articleId = id;
        KbManagement.PublishingService.archiveOnlineArticle(articleId, null);
    }
}
Thank You,
Hitesh Patel
Email :- hiteshpatel.aspl@gmail.com
http://mrjavascript.blogspot.in/