- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 02:43 AM
Hi everyone,
I am attempting to create a notification to tell people when their knowledge article is about to expire.
I have registered the event, created the scheduled job and the notification fired by the event. Everything runs as expected, but I am running into problems trying to dotwalk to another table in order to supply the author's manager as parm2 to the event.
My scheduled job looks like this.
gr.author works fine and fires the event, which sends the notification to the kb article' author, but as author is a reference field I cannot work out how to dot walk to obtain the author's manager to insert into parm2 in the gs.eventQueue() function below. gr.author.manager, current.author.manager and any other variation seems to fail.
There are no log messages, parm2 is just empty in the event log.
Any ideas as to the correct syntax?
Here's the script:
function queryExpiringKBArticles() {
var gr = new GlideRecord('kb_knowledge');
gr.addEncodedQuery("workflow_state=published^valid_toONYesterday@javascript:gs.daysAgoStart(1)@javascript:gs.daysAgoEnd(-14)"); //this will give you all the articles will expire in 14 days
gr.query();
gs.log(gr.getRowCount() + ' rows retrieved');
while (gr.next()) {
gs.eventQueue( 'kb.expiring', gr, gr.author, gr.author.manager );
}
}
Thanks
Mat
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 05:39 AM
Hi Mathew,
As you are already passing the glideRecord object of the KB record, non need to pass additional parameters. Simply select knowledge as table in email notification and then select the recipients from fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 04:00 PM
use below code:
gr.author.manager.sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 08:06 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 08:42 PM
Hi Mathew,
try with gr.author.manager.name
also you can check with script below. debug it through log. you can even run it in your background script.
var gr = new GlideRecord('kb_knowledge');
gr.addEncodedQuery("workflow_state=published^valid_toONYesterday@javascript:gs.daysAgoStart(1)@javascript:gs.daysAgoEnd(-14)"); //also validate with encodedquery if it's correct or not.
gr.query();
gs.print(gr.getRowCount() + ' rows retrieved');
while (gr.next()) {
gs.print( 'kb.expiring',+ gr.author+' '+' '+ gr.author.manager.name );
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 05:32 AM
Hi,
Unfortunately none of the suggestions worked - neither gr.author.manager.name nor gr.author.manager.sys_id.
I have indeed got parm2 contains recipient ticked on the notification - however looking at the event log the parameter isn't even being passed by the scheduled job.
Looking at the kb_knowledge table, author is a reference field from the sys_user table so I cannot see any reason why I shouldn't be able to dotwalk to fields in this table?
gs.print( 'kb.expiring',+ gr.author+' '+' '+ gr.author.manager.name );
Not sure this syntax is correct as nothing happens?
Mat