…thoughts on ServiceNow and digital transformation

Post

ServiceNow Employee Center Check for new content in categories not working


In a the Taxonomy Topic form , you can add Connected Categories for Knowledge. Doing this should add new articles to the Connected Content for the give Topic, but it doesn’t. There is a related link Check for new content in categories, but this link doesn’t add the new articles either. The only way I was able to get the new articles added to the Connected Content list is by removing the Connected Category and adding it back. Annoying.

An answer in this community post pointed out the schedule job Surface New Unconnected Content of Categories, which runs once a week (!) on Sundays. This job seems to add content to the unconnected_category_content table, but you still have to go in there and click on a UI Action in the form or the list to add the content to the categories. To avoid this pain and suffering, I created the business rule below on the kb_knowledge table. This adds the new article automatically to the Connected Content for the Topic.

Name: Add Employee Center Connected Content

Table: kb_knowledge

When: async

Conditions: kb_category IS NOT EMPTY AND kb_category CHANGES

Advanced

Script

(function executeRule(current, previous /*null when async*/ ) {

	//adds articles to the Employee Center Taxonomy Topic Connected Content 

    //check if the category is connected to a topic
    var connectedGR = new GlideRecord('m2m_connected_category');
    connectedGR.addQuery('kb_category', current.kb_category);
    connectedGR.query();
    if (connectedGR.next()) {
        addNewConnectedContent()
    }

    function addNewConnectedContent() {

        // OOB this is run only once a week /nav_to.do?uri=sysauto_script.do?sys_id=2daff9e8eb9551103d6b2ff2a252289b
        new global.TopicCategoryContentSurfacingUtil().surfaceNewContent();


        var listGR = new GlideRecord('unconnected_category_content');
        listGR.query();
        while (listGR.next()) {
            //OOB this is from /nav_to.do?uri=sys_ui_action.do?sys_id=116425b377451110cd1b756f1b5a992f
            new global.TopicCategoryUtil().moveNewCategoryContentToConnectedContent(listGR);
        }

    }

})(current, previous);