User Tools

Site Tools


snc_coalescing_strategies

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
snc_coalescing_strategies [2018/01/26 08:38]
jackson.davenport
snc_coalescing_strategies [2018/09/04 13:32] (current)
jackson.davenport
Line 2: Line 2:
 This is to describe the different ways you can coalesce (e-bond) for a __**ServiceNow to ServiceNow**__ integration. There are  options depending on what variables you have access to.  ​ This is to describe the different ways you can coalesce (e-bond) for a __**ServiceNow to ServiceNow**__ integration. There are  options depending on what variables you have access to.  ​
  
-For integrations between ServiceNow and other platforms the coalescing strategy will be slightly different. However, per the <wrap info>vB</​wrap>​ release the strategies have become closer.+For integrations between ServiceNow and other platforms the coalescing strategy will be slightly different. However, per the <wrap info>vBismuth</​wrap>​ release the strategies have become closer.
  
 ===== Strategy ===== ===== Strategy =====
Line 58: Line 58:
 You can see this logic under the Transform Field Map for Target Field sys_id You can see this logic under the Transform Field Map for Target Field sys_id
  
-{{:coalescingstrategy_sysid_vb.png|}}+{{::​commondoccoalescingvcarbon.png|}} 
 + 
 +For reference here is that same code: 
 + 
 +<code javascript>​ 
 +answer = (function transformEntry(source) { 
 + var gr = new GlideRecord('​incident'​);​  
 + var qc = gr.addQuery('​correlation_id',​ source.u_sys_id);​ 
 + qc.addOrCondition('​sys_id',​ source.u_correlation_id);​ 
 + gr.query();​ 
 + if (gr.next()) { 
 + return gr.sys_id;​ 
 +
 +  
 + return gs.generateGUID();​ // no return found, return a new sys_id to create a new record 
 +})(source);​ 
 +</​code>​
  
 Overall the inbound map processes the target fields like: Overall the inbound map processes the target fields like:
Line 69: Line 85:
  
 === Optional (sys_id to sys_id)=== === Optional (sys_id to sys_id)===
 +If you are setting up something custom and you are not using the standard approach we recommend you create a similar set up where you are coalescing against sys_id. ​ Where the main component of the coalescing is still against sys_id.
 +
 ^  Source ​ ^   ​Target Field   ​^ ​ Coalesce ​ ^ ^  Source ​ ^   ​Target Field   ​^ ​ Coalesce ​ ^
 |     ​sys_id ​    ​| ​     sys_id ​     |    true    | |     ​sys_id ​    ​| ​     sys_id ​     |    true    |
Line 74: Line 92:
  
  
-We will be using sys_id and number. What this means is that we are going to be coalescing on sys_id as well as mapping the number into the correlation_id field. ​+This means that we are still going to be coalescing on sys_id as well as mapping the number into the correlation_id field. ​
  
-It is also best practice to force the GUID value (sys_id) of the target record. ​ Otherwise within an onBefore Script you can call **target.setNewGuidValue(source.u_sys_id)** like below:+The following script will look up a record where the target'​s ​sys_id ​matches ​the incoming sys_id
  
-{{:​transformmap-onbefore_script.png?700|}}+<code javascript>​ 
 +answer = (function transformEntry(source) ​{ 
 + var gr = new GlideRecord('​incident'​);​  
 + gr.addQuery('​sys_id',​ source.u_sys_id);​ 
 + gr.query();​ 
 + if (gr.next()) ​{ 
 + return gr.sys_id; 
 + } 
 +  
 + return gs.generateGUID();​ // no return found, return a new sys_id to create a new record 
 +})(source);​ 
 +</​code>​
  
-What this also means is that we won't be touching the number ​on the Subscribing side.  We are letting the instance auto-generate the number. ​ We also won't be using the Shared correlation_id on the Subscribing side (which is essentially the same as the sys_id)but it is available to use if you would like.+You can adjust ​this coalescing logic to add queries for number, ​correlation information,​ or usernames (if doing sys_user).
  
 ==== Modifications to Column Name ==== ==== Modifications to Column Name ====
Line 109: Line 138:
 var qc = gr.addQuery('​u_my_correlation_id',​ source.u_sys_id);​ var qc = gr.addQuery('​u_my_correlation_id',​ source.u_sys_id);​
 </​code>​ </​code>​
-Leaving the script otherwise the same.+ 
 +Leaving the script otherwise the same
 + 
 +<code javascript>​ 
 +answer = (function transformEntry(source) { 
 + var gr = new GlideRecord('​incident'​);​  
 + var qc = gr.addQuery('​u_my_correlation_id',​ source.u_sys_id);​ 
 + qc.addOrCondition('​sys_id',​ source.u_correlation_id);​ 
 + gr.query();​ 
 + if (gr.next()) { 
 + return gr.sys_id;​ 
 +
 +  
 + return gs.generateGUID();​ // no return found, return a new sys_id to create a new record 
 +})(source);​ 
 +</​code>​
snc_coalescing_strategies.txt · Last modified: 2018/09/04 13:32 by jackson.davenport