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)); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter