- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2015 08:48 AM
Hello!
I have created an approval email notification and template for a knowledgebase approval workflow and I cannot get the email to kick off. I have approval emails for Change and Request that fire based on task type Change/Request but I cannot find a condition for knowledge that is working. I thought it would be knowledge submission but that isn't it.
Any idea how to fire an approval email based on knowledge in review state to be approved to be published?
Thank you!
Danielle
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2015 12:36 PM
Hi Leah,
I worked with HI on a solution for this and I have to create a mail script to make this work since the notification needs to come from the approval table but the fields are on the KB table. All is working for us now. I hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 08:09 AM
Can someone share the whole working solution? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 10:13 AM
Hi Martijn,
What solution are you looking for? If you see one of my earlier posts on this thread you will see the solution I used, although some day I will rewrite it to use mail scripts within the template. If that post is not what you're looking for that is fine, but if it is, let me know what information to complete your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 10:17 AM
Hi John,
I tried to use your solution. But it did not work. I don't see how you connect to the Knowledge DB. Maybe I miss your scripts...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 10:58 AM
OK. No problem. Here's the entire setup I'm using currently.
Business Rule - Approval Events (Non-Task)
After Insert/Update on sysapproval_approver - Active - Advanced - Order 1,001
Condition - (current.source_table != '' && new TableUtils(current.source_table).getAbsoluteBase() != 'task') && current.state.changes()
Script
sendEventsNonTask();
function sendEventsNonTask() {
if (!current.state.changes())
return;
var event = current.source_table;
switch (current.state + "") {
case 'cancelled':
event += ".approval.cancelled";
gs.eventQueue(event, current, gs.getUserID(), gs.getUserName());
break;
case 'requested':
event += ".approval.inserted";
gs.eventQueue(event, current, gs.getUserID(), gs.getUserName());
updateRecord(current, current.approver.getDisplayValue() + " requested to approve task");
break;
case 'rejected':
event += ".approval.rejected";
gs.eventQueue(event, current, current.state, previous.state);
updateRecord(current, current.approver.getDisplayValue() + " rejected the task.", current.comments);
notifyMyFriends(current);
break;
case 'approved':
updateRecord(current, current.approver.getDisplayValue() + " approved the task.", current.comments);
break;
default:
}
}
function updateRecord(me, journal, comments) {
// if this is for a group approval, don't log this user action since the Group Approval Activity will handle the logging
if (!me.group.nil())
return;
// For a Non-task, we use the following:
// - sysapproval_approver.document_id
// - sysapproval_approver.source_table
// - sysapproval_approver.approval_column
// - sysapproval_approver.approval_journal_column
// only log the user approval activity for workflows when specifically turned on
// otherwise, we spam the approval history log when it is almost never desired to track via the approval history journal field
var isWorkflow = !me.wf_activity.nil();
if (isWorkflow && (gs.getProperty("glide.workflow.user_approval_history") != "true"))
return;
if (comments)
journal += " Comments: " + comments;
var record = new GlideRecord(me.source_table);
if (record.get(me.document_id)) {
if (isWorkflow)
record.setWorkflow(false);
record[me.approval_journal_column].setJournalEntry(journal);
record.update();
}
}
The above will log an event named kb_knowledge.approval.inserted on sysapproval_approver.
Notification - Knowledge Approval Request
Table - sysapproval_approver
Type - EMAIL
When to send - Record inserted or updated (could have used event - was a newbee when I configured this)
Conditions for When to send - Source Table is kb_knowledge AND State is Requested
Who will receive - Approver / Send to event creator
What it will contain - Content Type - HTML and plain text - Email Template - knowledge.itil.approve.role
Template - knowledge.itil.approve.role
Table - sysapproval_approver
Subject - ${document_id.sys_class_name} Article ${document_id.number} - Approval Stage: ${document_id.workflow_state}
Message - (this is awful and should be done using mail script)
<div>Approval Stage: ${document_id.workflow_state}</div>
<div>Short description: ${document_id.short_description}</div>
<div>Knowledge base: ${document_id.kb_knowledge_base}</div>
<div>Category: ${document_id.kb_category}</div>
<div>Author: ${document_id.author}</div>
<div>Published: ${document_id.published}</div>
<div>Owning Group: ${document_id.u_owning_group}</div>
<div> </div>
<div>
<div><hr /></div>
</div>
<div>${mailto:mailto.kbapproval}</div>
<div>
<div><hr /></div>
</div>
<div>Click here to view or reject the Approval Request: ${URI}</div>
<div>Click here to view ${document_id.sys_class_name} Article: ${document_id.URI_REF}</div>
Template - mailto.kbapproval
Table - sysapproval_approver
Subject - Re:${document_id.number} - approve
Message HTML - Click here to approve ${document_id.number}
I believe the above configuration will get you what you're looking for. The following is a knowledge approval request that went out earlier today.
Subject - Knowledge Article KB0010844 - Approval Stage: Review
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 11:04 AM
Thanks a lot. Have a nice day!