Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


HTML
<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>



ServiceNow keeps track of the views for each Knowledge Base (kb_knowledge) article by updating the View Count (sys_view_count) field on the article's record each time it is viewed. However this update is done such that no other fields are updated on the record (including system fields such as the sys_updated_on field) and as a result does not trigger business rules or flows (including those created by dynamic shares) to fire.

However since article views fire a kb.view event each time an article is viewed, we can 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 onlyis triggered when this event happens. This will allow you to dynamically share out Knowledge Base articles when the view count is changed



Procedures

To start sharing knowledge articles through a script action, follow these proceduresthis procedure


UI Steps


UI Step

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


UI Step

Choose Dynamic Share Type

Select Business Rule and click the Submit button.


UI Step

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


UI Step

Navigate to Script Actions 

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


UI Step

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: 

Code Block
languagejs
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



 




Similar topics


Content by Label
showLabelsfalse
max5
showSpacefalse
sortmodified
cqllabel = "datasync-for-servicenow" and space = currentSpace()

Contact Perspectium Support


US: 1 888 620 8880

UK: 44 208 068 5953

support@perspectium.com  

...