- 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-21-2017 05:36 AM
HI mathew,
did you check my suggestion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 05:44 AM
Yes, my notification is set with parm2 contains recipient ticked - however as I mentioned the scheduled job is not even passing a value into the event.
I know that there's nothing broken with the statement because if I pass gr.author as both parm1 and parm2 they appear in the event:
gs.eventQueue( 'kb.expiring', gr, gr.author, gr.author );
When I review the event log I can see the sys_ID of the author value in both parm1 and parm2 as expected. Therefore it is clearly something wrong with trying to access the reference table via dotwalking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 05:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 05:56 AM
I did think that - strangely exactly the same thing happens.
Even if I untick Event Parm 1 contains recipient/Event Parm 2 contains recipient and then select Author and Author.Manager (or Author.Email and Author.Manager.Email), the notification still only sends to the author.
If I only select Author.Manager (removing sent to event creator to prevent the event being generated firing the notification), the notification doesn't fire.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 06:45 AM
Oh dear!
It might have helped if I had checked that gr.author.manager actually has a value for the objects being returned by the scheduled job!
The field isn't even being used with my LDAP lookup transform map and there are no values in the entire sys_user table.
Newbie error...
Thanks everyone for your help.