Blog

Add Workflow to ServiceNow Knowledge

Here is a quick fix to add workflow to ServiceNow Knowledge

There is a huge advantage to do this. Workflow can allow easier visibility into the current process, it is easier to explain, and easier to use than standard Business Rules. Also you can use workflow to generate approvals, events, and other tasks.

Below are the steps to add workflow to SN Knowledge:

CODE

1. Add UI Action: Show Workflow

Note: You can also just copy an existing "Show Workflow" UI Action and change the table to kb_knowledge.
Table: kb_knowledge
Form Link: true
On Click: showWorkflowContext()
Condition: !current.isNewRecord() && (new Workflow().hasWorkflow(current))
Script:
// Show the workflow context in a new window
function showWorkflowContext() {
var id = $F('sys_uniqueValue');
var url = new GlideURL('context_workflow.do');
url.addParam('sysparm_stack', 'no');
url.addParam('sysparm_table', g_form.getTableName());
url.addParam('sysparm_document', id);
var w = getTopWindow();
w.popupOpenFocus(url.getURL(), 'show_workflow_context', 950, 700, '', false, false);
}

2. Add UI Action: Workflow Context

Note: You can also just copy an existing "Workflow Context" UI Action and change the table to kb_knowledge.
Table: kb_knowledge
Form Link: true
On Click: showWorkflowContext()
Condition: gs.hasRole('workflow_admin') && !current.isNewRecord() && (new Workflow().hasWorkflow(current))
Script:
var url = 'wf_context.do?sysparm_query=id=' + current.sys_id.toString();
action.setRedirectURL(url);

3. Workflow Properties

Create a workflow for Knowledge.

In your workflow properties, add the table: kb_knowledge and any conditions you need.

You can create a workflow with approvals, notifications etc.

4. Related Lists

On your Knowledge Form, you can add the related lists for approvals if needed.