Using Apex with Knowledge - Technical Potpourri from Sudipta Deb

PHOTO EMBED

Tue May 16 2023 09:26:42 GMT+0000 (Coordinated Universal Time)

Saved by @hurrand

if (allArticles.size() > 0) {
    Integer count = 0;
 List<Knowledge__kav> scope = new List<Knowledge__kav>();
 for (Knowledge__kav single : allArticles) {
     if (count < BATCH_SIZE) {
     count++;
 scope.add(single);
 } else if (count == BATCH_SIZE) {
 count = 0;
 System.enqueueJob(new KnowledgeEditQueue(scope));
 scope = new List<Knowledge__kav>();
 scope.add(single);
 }
 }
 if (!scope.isEmpty()) {
     System.enqueueJob(new KnowledgeEditQueue(scope));
 }
 }
content_copyCOPY

Calling Queuable

https://sudipta-deb.in/2020/09/using-apex-with-knowledge.html