<style>
.release-box {
	height: 30px; 
	width: 100px; 
	padding-top: 8px;
	text-align: center; 
	border-radius: 5px; 
	font-weight: bold; 
	background-color: #d4af37;  
	border-color: #FCE28A;
}

.release-box:hover {
  	cursor: hand;
    cursor: pointer;
    opacity: .9; 
}
</style>
<meta name="robots" content="noindex">

<div class="release-box">
<a href="https://docs.perspectium.com/display/gold" style="text-decoration: none; color: #FFFFFF; display: block;">
Gold
</a>
</div>




Prerequisites 


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, 'update', qc.sys_id);	
	}
}

Click Submit



 




Similar topics


Contact Perspectium Support


US: 1 888 620 8880

UK: 44 208 068 5953

support@perspectium.com