• Default Workflow User
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I have an issue with the v25.0 .  I am trying to test one of the new functionality that was release in v25.0. " KbManagement.PublishingService.publishArticle(KnowledgeArticleId, true)"

This is suppose to allow you programmatically publish an  KnowledgeArticle that is in draft status.  I wrote a simple class to test this functionality and it worked fine but I have about 120000 records to process to I figure I write a batchable class(seen below). 

 

// 

// (c) 2012 Appirio, Inc.

//

// Description: This class implements the batchable interface and is used to publish  KnowledgeArticles in draft Status  

//               

//

global with sharing class  PublishKnowledgeArticlesBatchClass implements Database.Batchable <sObject>{

 

  global Database.QueryLocator start(Database.BatchableContext BC){

    //String should be modifed depending on the number of records that the Publish Service can support

      String query = 'SELECT Title, Id, KnowledgeArticleId, PublishStatus, VersionNumber '

              + ' FROM KnowledgeArticleVersion ' 

                  +  ' WHERE PublishStatus =\'Draft\' '

                    + '  AND language =\'en_US\' AND LastModifiedDate =TODAY LIMIT 5';                    

        return Database.getQueryLocator(query);

      

    }

 

    global void execute(Database.BatchableContext BC, List<KnowledgeArticleVersion> scope){

       //Call the PublishService with the id of each KnowledgeArticleId

        for(KnowledgeArticleVersion s : scope){

            KbManagement.PublishingService.publishArticle(s.KnowledgeArticleId, true);

        }      

       

    }

 

    global void finish(Database.BatchableContext BC){

  

    }

}

 

However when i run the batch process, this is the response I get in the log.  

 

25.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO

09:50:00.144 (144586000)|EXECUTION_STARTED

09:50:00.144(144629000)|CODE_UNIT_STARTED[EXTERNAL]|01pQ00000001y9b|PublishKnowledgeArticlesBatchClass

09:50:00.164 (164988000)|FATAL_ERROR|Internal Salesforce.com Error

09:50:00.096 (165018000)|CUMULATIVE_LIMIT_USAGE

09:50:00.096|CUMULATIVE_LIMIT_USAGE_END

09:50:00.169 (169593000)|CODE_UNIT_FINISHED|PublishKnowledgeArticlesBatchClass

09:50:00.169 (169604000)|EXECUTION_FINISHED

 

Please any assistance will be greatly appreciated.

Regards

-H