public class TriggerHandlerOnKnowledge { public static void run() { if(Trigger.isAfter && Trigger.isInsert) { publishHighPriority((List<Knowledge__kav>)Trigger.new); } } private static void publishHighPriority(List<Knowledge__kav> articles) { for(Knowledge__kav article: articles) { if(article.priority__c == 'High') { KbManagement.PublishingService.publishArticle(article.KnowledgeArticleId, false); } } } }
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