You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »


Viewing a Knowledge Base article in ServiceNow does not trigger a Business Rule to fire. Due to this limitation, the dynamic share does not trigger as well. To guarantee that an outbound message gets created, you will need to create a ServiceNow Script Action that are triggered through events only. 



Procedures

To start sharing knowledge articles through script action, follow these procedures: 


Navigate to Dynamic Share

In ServiceNow's left side navigation window, navigate to Perspectium > Replicator > Dynamic Share or simply type and then click on Dynamic Share

Click New. 

Choose Dynamic Share Type

Select Business Rule and click the Submit button.

Create a Dynamic Share 

Select Knowledge in the Table dropdown, and check the Active box. 

Under the Trigger Conditions tab, check the Update box. Then, follow the rest of the steps in Create a ServiceNow dynamic share

Navigate to Script Actions 

In ServiceNow's left side navigation window, navigate to System Policy > Events > Script Actions. Then, click New

Create Script Action

In the Name field, type in Perspectium Share Knowledge. Select kb.view as the Event name, and check the Active box. 

Then, fill in the Script field with the following: 

pspShareKnowledge();

function pspShareKnowledge() {
	var pspR = new PerspectiumReplicator();
	var tableName = "kb_knowledge";
	
	var kbgr = new GlideRecord(tableName); 
	kbgr.get('sys_id', event.instance);
	kbgr.query();
	if (!kbgr.next())
		return; 
	
	var qc = new GlideRecord('psp_replicate_conf');
	qc.addQuery("table_name", tableName);
	qc.addQuery("sync_direction", "share");
	qc.addQuery("action_update", "true");
	qc.addQuery("active", "true");
	qc.query();
	while(qc.next()) {
		pspR.shareRecord(kbgr, tableName, 'bulk', qc.sys_id);	
	}
}

Click Submit