Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get user who checkout the knowledge article

chandan15
Tera Contributor

Hi All,

I have written a scheduled job->script to check and send notification if a knowledge article is check out since 7 days. 

The question is how can I send notification to the user who have check out the Article.?

 

Scheduled Job code:

sendDraftKBNotification();

function sendDraftKBNotification() {
	var toDay = new GlideDateTime();
    var queryTime = new GlideDateTime();
    queryTime.addDaysUTC(-7);

    if (toDay > queryTime) {
        var gr = new GlideRecord('kb_knowledge');
        gr.addQuery('workflow_state','draft');
        gr.addQuery('sys_updated_on', '<', gs.daysAgo(-7));
		gr.addEncodedQuery('kb_knowledge_base=05b7cac1ff133100158bffffffffffc4^ORkb_knowledge_base=dd1bf50cdb2b0490194bf7461d961948');		
        gr.query();
        while (gr.next()) {
            gs.eventQueue('kb.draft.notification', current, null, null);
			gr.sys_updated_on=toDay;
			gr.update();
        }
    }
}

 

At least I would like to know, how can I getUser, who have check out the KA.

 

Thanks,

Chandan

1 REPLY 1

Nia McCash
Mega Sage
Mega Sage

I believe the user who checked out the article is in the Revised by field - which you can use in the script or as a recipient in your email notification

 

NiaMcCash_0-1689947670810.png