<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://www.xlayer.co.za/forum/extern.php?action=feed&amp;fid=4&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[SXI Forum / General Discussion]]></title>
		<link>https://www.xlayer.co.za/forum/index.php</link>
		<description><![CDATA[The most recent topics at SXI Forum.]]></description>
		<lastBuildDate>Thu, 02 Sep 2021 18:15:31 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[MSSQL - DATEPART() function to get the integer value of datetime]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=139&amp;action=new</link>
			<description><![CDATA[<p>The DATEPART() function returns a specified part of a datetime, this function returns the result as an integer value.<br />Example will give you only the data entries with the date of 2021-01-01:</p><div class="codebox"><pre><code>SELECT [Flag],
       [Epoc],
       [Date],
       [Action],
       [EID],
       [UID] 
FROM MyTable 
WHERE DATEPART(year,[Date]) = &#039;2021&#039; and  DATEPART(month,[Date]) = &#039;01&#039; and DATEPART(day,[Date]) = &#039;01&#039;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (StephanB)]]></author>
			<pubDate>Thu, 02 Sep 2021 18:15:31 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=139&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Using the SharePoint API]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=137&amp;action=new</link>
			<description><![CDATA[<p>I stumbled upon this really helpful document of how to consume the SharePoint API</p><p><a href="https://www.codeproject.com/Articles/990131/CRUD-Operation-to-List-Using-SharePoint-Rest-API" rel="nofollow">https://www.codeproject.com/Articles/99 … t-Rest-API</a></p>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Mon, 19 Jul 2021 15:01:48 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=137&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[CA signed Certificate for XLayer server]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=136&amp;action=new</link>
			<description><![CDATA[<p>These steps will outline how to initially request a new certificate from <a href="https://za.godaddy.com/web-security/ssl-certificate" rel="nofollow">GoDaddy</a> on a windows server.&#160; This will not replace the certificate if a client already has a procedure to obtain certs for us, this is only if we are purchasing the cert ourselves.</p><p>If this is the first time you are adding a certificate to the server you will need to provide GoDaddy with a CSR (Certificate Signing Request).&#160; you will need to generate this CSR before requesting the certificate from GoDaddy.</p><p><strong>Requirements</strong><br /><a href="https://keystore-explorer.org/" rel="nofollow">KeyStore Explorer</a></p><p><strong>Steps</strong></p><ol class="decimal"><li><p>Open KeyStore Explorer and &quot;Create a new Keystore&quot;</p></li><li><p>In the &quot;New KeyStore Type&quot; dialog box that pops up select <strong>PKCS #12</strong></p></li><li><p>Select Tools -&gt; Generate Key Pair from the menu or press Ctrl + G</p></li><li><p>In the &quot;Generate Key Pair&quot; dialog box that pops up select RSA with a key size of 2048 and click <strong>OK</strong></p></li><li><p>A new dialog box will popup and you can leave most of those values default (This will be valid for 1 year)</p></li><li><p>You need to provide additional details for the certificate before clicking OK.&#160; Just above the &quot;Add Extensions&quot; button there is an Icon that looks like a filofax with an &quot;@&quot; sign on it.&#160; Click That.</p></li><li><p>Populate the fields with valid responses (Replace the values in between &lt;&gt;test:</p><ul><li><p>Common Name(CN): <em>&lt;server.name.domain.com&gt;</em></p></li><li><p>Organization Unit(OU): <em>&lt;Company Name&gt;</em></p></li><li><p>Organization Name(O): <em>&lt;Company Name&gt;</em></p></li><li><p>Locality Name(L): <em>&lt;Johannesburg&gt;</em></p></li><li><p>State Name(ST): <em>&lt;Gauteng&gt;</em></p></li><li><p>Country(C): <em>&lt;ZA&gt;</em></p></li></ul></li><li><p>Click <strong>Ok</strong>. You will notice that in the &quot;Name&quot; field your values have been populated.</p></li><li><p>After verifying your values Click <strong>Ok</strong></p></li><li><p>A &quot;New Key Pair Entry Alias&quot; dialog box will appear. Enter an appropriate alias and Click <strong>Ok</strong></p></li><li><p>Enter and Confirm a new password in the &quot;New Key Pair Entry Password&quot; and click <strong>Ok</strong></p></li><li><p>After everything has been validated you will get confirmation that the <strong>Key Pair Generation was Successful</strong></p></li></ol><br /><p><strong>Generate CSR</strong></p><ol class="decimal"><li><p>Right-Click on the alias you created and select <strong>Generate CSR</strong></p></li><li><p>In the Generate CSR dialog box youcan select the location of the CSR file and click <strong>Ok</strong></p></li></ol><br /><p><strong>Request the New Certificate</strong></p><ol class="decimal"><li><p>On the GoDaddy website follow the prompts to create a new certificate.</p></li><li><p>When you get to the step to provide a CSR copy the contents of the file you created and past it into the space provided on the GoDaddy website.</p></li><li><p>You will get an Email when the certificate has been generated.&#160; Go to the relevant page a download the certificate (Server = &quot;Other&quot;)&#160; A zip file will be downloaded which contains 3 files:</p><ul><li><p>&lt;randomNumber&gt;.crt</p></li><li><p>&lt;randomNumber&gt;.pem</p></li><li><p>gd_bundle-g2-g1.crt</p></li></ul></li><li><p>When you have this file Right-Click on the Alias you created in the key store</p></li><li><p>On the dropdown menu click on &quot;Import CA Reply -&gt; From File&quot;</p></li><li><p>Select the &lt;randomNumber&gt;.crt file and click Import</p></li><li><p>You can Expect a &quot;CA Reply Import Successful&quot; message</p></li><li><p>You can now save this file as &lt;some name&gt;.p12</p></li></ol><p>Once you have saved this file you will be able to point to it from the XLayer Servers API calls.&#160; Here is an example.</p><div class="codebox"><pre><code>#===============================================================================
# Enable SSL operation
#===============================================================================
server.ssl.enabled=true
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:&lt;some name&gt;.p12
server.ssl.key-store-password=&lt;password used at &quot;New Key Pair Entry Password&quot;&gt;
server.ssl.key-alias=&lt;alias used in Key Pair generation&gt;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Tue, 01 Jun 2021 17:50:04 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=136&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Transfer files up to 2 GB.]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=76&amp;action=new</link>
			<description><![CDATA[<p>You can also use the XLayer hosted option at</p><p><a href="https://www.xlayer.co.za/file-drop/" rel="nofollow">XLayer File Drop</a></p>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Tue, 01 Jun 2021 16:42:27 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=76&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Find out SOME OF SCOMs defaults]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=134&amp;action=new</link>
			<description><![CDATA[<p>To get a list of all the possible values in SCOM you can call the following ()remember you still need to get the SessionID and authenticate before calling these APIs):</p><h5>Alert Columns</h5><div class="quotebox"><blockquote><div><p>http://&lt;SCOM_SERVER&gt;/OperationsManager/resources/alertColumns</p></div></blockquote></div><h5>Alert Priorities</h5><div class="quotebox"><blockquote><div><p>http://&lt;SCOM_SERVER&gt;/OperationsManager/resources/alertPriority</p></div></blockquote></div><h5>Alert Resolution States</h5><div class="quotebox"><blockquote><div><p>http://&lt;SCOM_SERVER&gt;/OperationsManager/resources/alertResolutionStates</p></div></blockquote></div><h5>Alert Severity</h5><div class="quotebox"><blockquote><div><p>http://&lt;SCOM_SERVER&gt;/OperationsManager/resources/alertSeverity</p></div></blockquote></div>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Thu, 22 Apr 2021 16:03:59 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=134&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Set the ResolutionState on an Alert in SCOM from PowerShell]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=133&amp;action=new</link>
			<description><![CDATA[<p>To Change the ResolutionState of an Alerts in SCOM create a PowerShell script (e.g. ChangeResolutionState.ps1) with the following code:</p><div class="codebox"><pre><code>$scomHeaders = New-Object &quot;System.Collections.Generic.Dictionary[[String],[String]]&quot;
$scomHeaders.Add(&#039;Content-Type&#039;,&#039;application/json; charset=utf-8&#039;)
$bodyraw = &quot;AuthenticationMode:&lt;DOMAIN&gt;\&lt;USERNAME&gt;:&lt;PASSWORD&gt;&quot;
$Bytes = [System.Text.Encoding]::UTF8.GetBytes($bodyraw)
$EncodedText =[Convert]::ToBase64String($Bytes)
$jsonbody = $EncodedText | ConvertTo-Json

$uriBase = &#039;http://&lt;SCOM_SERVER&gt;/OperationsManager/authenticate&#039;
$auth = Invoke-RestMethod -Method POST -Uri $uriBase -Headers $scomheaders -body $jsonbody -UseDefaultCredentials -SessionVariable websession

$query = @{
    &quot;alertids&quot; = @(&quot;&lt;UUID&gt;&quot;);
    &quot;comment&quot; = &quot;&lt;USEFUL_COMMENT&gt;&quot;;
    &quot;resolutionState&quot; = &lt;RESOLUTION_STATE&gt;;
}


$jsonquery = $query | ConvertTo-Json
$Response = Invoke-WebRequest -Uri &quot;http://&lt;SCOM_SERVER&gt;/OperationsManager/data/alertResolutionStates&quot; -Method Post -Body $jsonquery -ContentType &quot;application/json&quot; -UseDefaultCredentials -WebSession $websession</code></pre></div><p><strong>NOTES:</strong><br />1. Replace the &lt;DOMAIN&gt;\&lt;USERNAME&gt;:&lt;PASSWORD&gt; fields with the relevant user with access to query SCOM<br />2. Replace &lt;SCOM_SERVER&gt; with the hostname/IP Address of the SCOM server.<br />3. Change the &lt;USEFUL_COMMENT&gt; that means something for your administrators.<br />4. Replace &lt;RESOLUTION_STATE&gt; with the integer from the table below.</p><h5>ResolutionState</h5><div class="codebox"><pre><code>Acknowledged            = 249
Assigned to Engineering = 248
Awaiting Evidence       = 247
Closed                  = 255
New                     = 0
Resolved                = 254
Scheduled               = 250</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Thu, 22 Apr 2021 15:21:33 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=133&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Get SCOM Alerts using PowerShell and the REST API]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=132&amp;action=new</link>
			<description><![CDATA[<p>To <strong>COLLECT</strong> Alerts from SCOM create a PowerShell script (e.g. GetAlerts.ps1) with the following code:</p><div class="codebox"><pre><code>$scomHeaders = New-Object &quot;System.Collections.Generic.Dictionary[[String],[String]]&quot;
$scomHeaders.Add(&#039;Content-Type&#039;,&#039;application/json; charset=utf-8&#039;)
$bodyraw = &quot;AuthenticationMode:&lt;DOMAIN&gt;\&lt;USERNAME&gt;:&lt;PASSWORD&gt;&quot;
$Bytes = [System.Text.Encoding]::UTF8.GetBytes($bodyraw)
$EncodedText =[Convert]::ToBase64String($Bytes)
$jsonbody = $EncodedText | ConvertTo-Json

$uriBase = &#039;http://&lt;SCOM_SERVER&gt;/OperationsManager/authenticate&#039;
$auth = Invoke-RestMethod -Method POST -Uri $uriBase -Headers $scomheaders -body $jsonbody -UseDefaultCredentials -SessionVariable websession

$query = @{
&quot;classId&quot; = $null;
&quot;objectIds&quot; = $null;
&quot;criteria&quot;= &quot;(((Severity = &#039;1&#039;) or (Severity = &#039;2&#039;)) AND (ResolutionState = &#039;0&#039;))&quot; ;
&quot;displayColumns&quot; = &quot;severity&quot;,&quot;monitoringobjectdisplayname&quot;,&quot;name&quot;,&quot;age&quot;,&quot;repeatcount&quot;,&quot;lastmodified&quot;,&quot;resolutionstate&quot;,&quot;ticketid&quot;
} 

$jsonquery = $query | ConvertTo-Json
$Response = Invoke-WebRequest -Uri &quot;http://&lt;SCOM_SERVER&gt;/OperationsManager/data/alert&quot; -Method Post -Body $jsonquery -ContentType &quot;application/json&quot; -UseDefaultCredentials -WebSession $websession
$alerts = ConvertFrom-Json -InputObject $Response.Content
$alerts.rows | select id,monitoringobjectdisplayname,name,severity,resolutionstate,lastmodified,age,ticketid</code></pre></div><p>You will receive a <em>Response</em> that will look something like this</p><div class="quotebox"><blockquote><div><p>id&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: b506ce29-9bb8-4c93-8be0-6a53dfc68757<br />monitoringobjectdisplayname : demohost01.sxi.local<br />name&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: OleDB: Results Error<br />severity&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: Error<br />resolutionstate&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: New<br />lastmodified&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: 2021-04-22T08:20:41.2000000Z<br />age&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: 6 hours, 46 minutes<br />ticketid&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; : </p><p>id&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: f1400c42-1699-4e00-95fb-9482418be391<br />monitoringobjectdisplayname : demohost01.sxi.local<br />name&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: System Center Management Health Service Unloaded System Rule(s)<br />severity&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; : Error<br />resolutionstate&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; : New<br />lastmodified&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; : 2021-04-22T07:57:31.3270000Z<br />age&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; : 7 hours, 9 minutes<br />ticketid&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: </p><p>id&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: f1f3fd94-0a4d-4adc-bab6-960013d52f30<br />monitoringobjectdisplayname : demohost02.sxi.local<br />name&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;: OleDB: Results Error<br />severity&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; : Error<br />resolutionstate&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; : New<br />lastmodified&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; : 2021-04-22T08:20:41.2000000Z<br />age&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; : 6 hours, 46 minutes<br />ticketid&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;:</p></div></blockquote></div><p>The <em>$query</em> can be changed to fine-tune what you are collecting.&#160; Here are some starting parameters</p><h5>Severity</h5><div class="codebox"><pre><code>0 - Information
1 - Warning
2 - Error</code></pre></div><h5>Priority</h5><div class="codebox"><pre><code>0 - Low
1 - Medium
2 - High</code></pre></div><h5>ResolutionState</h5><div class="codebox"><pre><code>Acknowledged            = 249
Assigned to Engineering = 248
Awaiting Evidence       = 247
Closed                  = 255
New                     = 0
Resolved                = 254
Scheduled               = 250</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Thu, 22 Apr 2021 15:11:37 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=132&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[ERROR - Signal Registry Polling disabled]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=127&amp;action=new</link>
			<description><![CDATA[<p>This is to prevent the creation of duplicate transaction, the Signal Registry Polling will be disabled.<br />The specific workflow configuration will stop working when a condition for a non recoverable error was detected in the Signal Registry.</p>]]></description>
			<author><![CDATA[dummy@example.com (StephanB)]]></author>
			<pubDate>Mon, 01 Feb 2021 07:31:54 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=127&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Windows Authentication to SQL server from Java]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=20&amp;action=new</link>
			<description><![CDATA[<p>Here is an example:</p><div class="codebox"><pre><code>&lt;Connector id=&quot;XlayerDB&quot; type=&quot;DB&quot;&gt;
      &lt;Connection xsi:type=&quot;sxi:MSSQL&quot;&gt;
        &lt;sxi:Server&gt;127.0.0.1&lt;/sxi:Server&gt;
        &lt;sxi:User&gt;myuser&lt;/sxi:User&gt;
        &lt;sxi:Password&gt;secret&lt;/sxi:Password&gt;
        &lt;sxi:RetryDelay&gt;10&lt;/sxi:RetryDelay&gt;
        &lt;sxi:DBName&gt;SomeDB&lt;/sxi:DBName&gt;
        &lt;sxi:Properties&gt;
          &lt;sxi:Property name=&quot;useNTLMv2&quot; value=&quot;true&quot;/&gt;
          &lt;sxi:Property name=&quot;domain&quot; value=&quot;ACME&quot;/&gt;
        &lt;/sxi:Properties&gt;
        &lt;sxi:Port&gt;1433&lt;/sxi:Port&gt;
      &lt;/Connection&gt;
      &lt;sxi:ReturnCodes&gt;
        &lt;sxi:Success/&gt;
        &lt;sxi:RecoverableError&gt;
          &lt;sxi:Code&gt;.+Read timed out.+&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;.*Invalid state.+&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;.*SHUTDOWN is in progress.+&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;I/O Error: Connection reset by peer: socket write error&lt;/sxi:Code&gt;
        &lt;/sxi:RecoverableError&gt;
      &lt;/sxi:ReturnCodes&gt;
    &lt;/Connector&gt;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Tue, 12 Jan 2021 13:01:49 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=20&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[SXI License Request]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=115&amp;action=new</link>
			<description><![CDATA[<p>How many NIC &quot;network interface card&quot; do you have on the machine ?</p>]]></description>
			<author><![CDATA[dummy@example.com (StephanB)]]></author>
			<pubDate>Wed, 05 Aug 2020 12:15:14 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=115&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Using the X-Service Broker configuration to replace X-Notify]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=113&amp;action=new</link>
			<description><![CDATA[<p><strong><span class="bbu">Using the X-Service Broker configuration to collect X-HeatBeat files for replacing X-Notify.</span></strong><br />Setting up the SendXNotifications to consume the X-HeartBeat files &quot;X-Notify~nnnnnnnnnnnn.nnn.xml&quot; in X-ServiceBroker configuration to replace X-Notify going forward.</p><div class="quotebox"><blockquote><div><p>I want to give credit to Sibu and Zwido for helping me on this.<br /> Thanks you for helping me on this.....</p></div></blockquote></div><br /><p>The heartbeat is configured in the X-HBChecker Entities.xml file example below:</p><div class="codebox"><pre><code>  &lt;MD name=&quot;ServerName&quot;&gt;
    &lt;Entity type=&quot;XPress/Dispatch&quot;&gt;
      &lt;Enabled&gt;yes&lt;/Enabled&gt;
      &lt;Timing poll=&quot;360&quot; lag=&quot;2&quot; /&gt;
      &lt;Notification enabled=&quot;yes&quot; continuous=&quot;yes&quot;&gt;
        &lt;Data&gt;A :[TYPE]: Heartbeat for :[MD]: has :[STATUS]:&lt;/Data&gt;
      &lt;/Notification&gt;
    &lt;/Entity&gt;
  &lt;/MD&gt;</code></pre></div><p>When the server &quot;MD&quot; Server does not send a Heart Beat file to the Main XLayer Server that receives the X-HB files.<br />The X-HBChecker will create X-Notify~nnnnnnnnnnnn.nnn.xml file that is consumed by the X-Notify, going forward you can now disable X-Notify, once this is up and running. This will now be done in X-Service Broke with a Database.<br />The notification is now configured in the database and can be switched on or off.<br />You can also choose what type of notification you want to send to the recipients in the database.</p><br /><p><strong><span class="bbu">The setup is divided into two sections:</span></strong><br />Database Configuration.<br />X-ServiceBroker Configuration “SendXNotifications”.</p><p>The setup requirement is that you should have a MSSQL database running.<br />There are three tables as mentioned below which will be explained in detail in the database setup section steps and in the configuration setup section.</p><p>The DB tables will consist of the following tables</p><ul><li><p>XNotification_SendMessageConfigtables.</p></li><li><p>XNotification_Clientstables.</p></li><li><p>XNotification_Signaltables.</p></li></ul><p><strong><span class="bbu">Database Configuration:</span></strong></p><p><span class="bbu"><strong>Step.1</strong></span> - Create a new Database and Call it XLayer using the following:<br />1.&#160; &#160; Open Microsoft SQL Management Studio.<br />2.&#160; &#160; Connect to the database engine using database administrator credentials.<br />3.&#160; &#160; Expand the server node.<br />4.&#160; &#160; Right click Database and click on New Database.<br />5.&#160; &#160; Enter a database name “XLayer” and click OK to create the database.</p><p><span class="bbu"><strong>Step.2</strong></span> - Create the XNotification_Signal table.<br />The XNotification_Signal table is designed with switches that can be turned ON or OFF in the table to send out notifications using SMS, Email and Slack with 1 as on and 0 as off. <br />The Slack switches is used to send a notification to SXI Slack Notifications #clientnotifications channel.<br />The XDec switch is used to enable the configuration to generate an Event doc to log a call to ITSM. (You will have to build this config, If you need an example I do have one available that is running at BCX&quot;.</p><p>The Non-Clustered Index on the table is to prevent any duplicate HBMessages.</p><p>The query below will create two examples in the database, one is a FAILED and the other one is REPAIRED for the HBMessage.</p><p>When setting up the XNotification_Signal with more HBMessage to the database you will have two HBMessage massages that is created by X-HBChecker manly a FAILED and a REPAIRED HBMessage.</p><p><span class="bbu">Create the XNotification_Signal table with a Non-Clustered Index by executing the following query:</span></p><div class="codebox"><pre class="vscroll"><code>USE [XLayer]
GO
/****** Object:  Table [dbo].[XNotification_Signal] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[XNotification_Signal](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[MD] [nvarchar](max) NULL,
	[Email] [int] NULL,
	[XDec] [int] NULL,
	[SMS] [int] NULL,
	[Slack] [int] NULL,
	[HBMessage] [varchar](320) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[XNotification_Signal] ON 

INSERT [dbo].[XNotification_Signal] ([Id], [MD], [Email], [XDec], [SMS], [Slack], [HBMessage]) VALUES (1, N&#039;ServerName&#039;, 1, 1, 0, 0, N&#039;A XPress/Dispatch Heartbeat for ServerName has FAILED&#039;)
INSERT [dbo].[XNotification_Signal] ([Id], [MD], [Email], [XDec], [SMS], [Slack], [HBMessage]) VALUES (2, N&#039;ServerName&#039;, 1, 1, 0, 0, N&#039;A XPress/Dispatch Heartbeat for ServerName has REPAIRED&#039;)
SET IDENTITY_INSERT [dbo].[XNotification_Signal] OFF
SET ANSI_PADDING ON

GO
/****** Object:  Index [NonClusteredIndex] ******/
CREATE UNIQUE NONCLUSTERED INDEX [NonClusteredIndex] ON [dbo].[XNotification_Signal]
(
	[HBMessage] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO</code></pre></div><br /><p><span class="bbu"><strong>Step.3</strong></span> - Create the XNotification_SendMessageConfig table.</p><p>The table is designed to have the details of the Recipients that will get the Notifications. Some of the fields that we collect recipients to send mails to is Full Name, CellNumber and email address.</p><p>The CellNumber is used to send SMS to Orion web service for SMS&#039;s (currently used at Gijima)<br />The Subject and Body are configurable and used as part of sending the email notification.<br />When sending an email notification, the ~#~ is used to make line break on the Body of the email.</p><p>Create the XNotification_SendMessageConfig by executing the following query:</p><div class="codebox"><pre><code>GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[XNotification_SendMessageConfig](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[MD] [nvarchar](max) NULL,
	[FullName] [nvarchar](50) NULL,
	[CellNumber] [nvarchar](50) NULL,
	[Recipient] [nvarchar](max) NULL,
	[HBMessage] [nvarchar](max) NULL,
	[Subject] [nvarchar](max) NULL,
	[Body] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET IDENTITY_INSERT [dbo].[XNotification_SendMessageConfig] ON 

INSERT [dbo].[XNotification_SendMessageConfig] ([Id], [MD], [FullName], [CellNumber], [Recipient], [HBMessage], [Subject], [Body]) VALUES (1, N&#039;ServerName&#039;, N&#039;Stephan Booyzen&#039;, N&#039;08212312345&#039;, N&#039;stephan.booyzen@sxi.co.za&#039;, N&#039;A XPress/Dispatch Heartbeat for ServerName has FAILED&#039;, N&#039;XPress/Dispatch Heartbeat has failed for ServerName(Event Server @ The Client)&#039;, N&#039;Good day,~#~~#~XPress/Dispatch Heartbeat has failed for ServerName(Event Server @ The Client)~#~~#~Yours in Service,~#~ITSM&#039;)
INSERT [dbo].[XNotification_SendMessageConfig] ([Id], [MD], [FullName], [CellNumber], [Recipient], [HBMessage], [Subject], [Body]) VALUES (2, N&#039;ServerName&#039;, N&#039;Sibusiso Skosana&#039;, N&#039;08212312346&#039;, N&#039;sibusiso.skosana@sxi.co.za&#039;, N&#039;A XPress/Dispatch Heartbeat for ServerName has FAILED&#039;, N&#039;XPress/Dispatch Heartbeat has failed for ServerName(Event Server @ The Client)&#039;, N&#039;Good day,~#~~#~XPress/Dispatch Heartbeat has failed for ServerName(Event Server @ The Client)~#~~#~Yours in Service,~#~ITSM&#039;)
INSERT [dbo].[XNotification_SendMessageConfig] ([Id], [MD], [FullName], [CellNumber], [Recipient], [HBMessage], [Subject], [Body]) VALUES (3, N&#039;ServerName&#039;, N&#039;Zwidofhelangani Gabara&#039;, N&#039;08212312347&#039;, N&#039;zwido.gabara@sxi.co.za&#039;, N&#039;A XPress/Dispatch Heartbeat for ServerName has FAILED&#039;, N&#039;XPress/Dispatch Heartbeat has failed for ServerName(Event Server @ The Client)&#039;, N&#039;Good day,~#~~#~XPress/Dispatch Heartbeat has failed for ServerName(Event Server @ The Client)~#~~#~Yours in Service,~#~ITSM&#039;)
INSERT [dbo].[XNotification_SendMessageConfig] ([Id], [MD], [FullName], [CellNumber], [Recipient], [HBMessage], [Subject], [Body]) VALUES (4, N&#039;ServerName&#039;, N&#039;Stephan Booyzen&#039;, N&#039;08212312345&#039;, N&#039;stephan.booyzen@sxi.co.za&#039;, N&#039;A XPress/Dispatch Heartbeat for ServerName has REPAIRED&#039;, N&#039;XPress/Dispatch Heartbeat has repaired for ServerName(Event Server @ The Client)&#039;, N&#039;Good day,~#~~#~XPress/Dispatch Heartbeat has repaired for ServerName(Event Server @ The Client)~#~~#~Yours in Service,~#~ITSM&#039;)
INSERT [dbo].[XNotification_SendMessageConfig] ([Id], [MD], [FullName], [CellNumber], [Recipient], [HBMessage], [Subject], [Body]) VALUES (5, N&#039;ServerName&#039;, N&#039;Sibusiso Skosana&#039;, N&#039;08212312346&#039;, N&#039;sibusiso.skosana@sxi.co.za&#039;, N&#039;A XPress/Dispatch Heartbeat for ServerName has REPAIRED&#039;, N&#039;XPress/Dispatch Heartbeat has repaired for ServerName(Event Server @ The Client)&#039;, N&#039;Good day,~#~~#~XPress/Dispatch Heartbeat has repaired for ServerName(Event Server @ The Client)~#~~#~Yours in Service,~#~ITSM&#039;)
INSERT [dbo].[XNotification_SendMessageConfig] ([Id], [MD], [FullName], [CellNumber], [Recipient], [HBMessage], [Subject], [Body]) VALUES (6, N&#039;ServerName&#039;, N&#039;Zwidofhelangani Gabara&#039;, N&#039;08212312347&#039;, N&#039;zwido.gabara@sxi.co.za&#039;, N&#039;A XPress/Dispatch Heartbeat for ServerName has REPAIRED&#039;, N&#039;XPress/Dispatch Heartbeat has repaired for ServerName(Event Server @ The Client)&#039;, N&#039;Good day,~#~~#~XPress/Dispatch Heartbeat has repaired for ServerName(Event Server @ The Client)~#~~#~Yours in Service,~#~ITSM&#039;)
SET IDENTITY_INSERT [dbo].[XNotification_SendMessageConfig] OFF</code></pre></div><br /><p><span class="bbu"><strong>Step.4</strong></span> - Create the XNotification_Clients table.<br />The XNotification_Clients table is designed to have the server names and client names. This is to create the X-DEC document when the switch is enabled for XDec in the XNotification_Signal table. This is used to log the Events to the specific Client in ITSM.<br />The Non-Clustered Index on the table is to prevent any duplicate Server names in the Database.</p><div class="codebox"><pre class="vscroll"><code>USE [XLayer]
GO
/****** Object:  Table [dbo].[XNotification_Clients] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[XNotification_Clients](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Server] [nvarchar](100) NULL,
	[Client] [nvarchar](100) NULL
) ON [PRIMARY]

GO
SET IDENTITY_INSERT [dbo].[XNotification_Clients] ON 

INSERT [dbo].[XNotification_Clients] ([Id], [Server], [Client]) VALUES (1, N&#039;ServerName&#039;, N&#039;Client&#039;)

SET IDENTITY_INSERT [dbo].[XNotification_Clients] OFF
SET ANSI_PADDING ON

GO
/****** Object:  Index [NonClusteredIndex] ******/
CREATE UNIQUE NONCLUSTERED INDEX [NonClusteredIndex] ON [dbo].[XNotification_Clients]
(
	[Server] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO</code></pre></div><p><strong><span class="bbu">X-ServiceBroker Configuration “SendXNotifications”:</span></strong></p><div class="codebox"><pre class="vscroll"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;iso-8859-1&quot;?&gt;
&lt;Configuration xmlns=&quot;http://www.sxi.co.za/XMLSchema/StandardWorkflow&quot; xmlns:sxi=&quot;http://www.sxi.co.za/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://www.sxi.co.za/XMLSchema/StandardWorkflow ../../../schema/plugins/workflows/SendXNotification.xsd&quot;&gt;

  &lt;sxi:Logging&gt;
    &lt;sxi:Retention&gt;7&lt;/sxi:Retention&gt;
    &lt;sxi:Directory /&gt;
    &lt;sxi:Level&gt;TRACE&lt;/sxi:Level&gt;
    &lt;sxi:MaxFileSize&gt;10&lt;/sxi:MaxFileSize&gt;
  &lt;/sxi:Logging&gt;

  &lt;GlobalNotifications&gt;
    &lt;Error enabled=&quot;no&quot; dataDefinition=&quot;&quot; transmitMethod=&quot;HIGH&quot; destination=&quot;localhost&quot; /&gt;
    &lt;General enabled=&quot;no&quot; dataDefinition=&quot;Notifier&quot; transmitMethod=&quot;LOW&quot; destination=&quot;localhost&quot; /&gt;
  &lt;/GlobalNotifications&gt;

  &lt;Heartbeats enabled=&quot;no&quot;&gt;
    &lt;Destination&gt;localhost&lt;/Destination&gt;
    &lt;Interval&gt;300&lt;/Interval&gt;
  &lt;/Heartbeats&gt;

  &lt;Connectors&gt;

    &lt;!-- SOAP Web Service to Send SMS for Gijima --&gt;
    &lt;Connector id=&quot;SMSWEBConnector&quot; type=&quot;SOAPWebService&quot;&gt;
      &lt;Connection xsi:type=&quot;sxi:SOAPWebService&quot;&gt;
        &lt;sxi:SOAPVersion&gt;1.1&lt;/sxi:SOAPVersion&gt;
        &lt;sxi:Namespaces&gt;
          &lt;sxi:Namespace prefix=&quot;tem&quot; uri=&quot;http://tempuri.org/&quot;/&gt;
        &lt;/sxi:Namespaces&gt;
        &lt;sxi:CustomHeaders&gt;
          &lt;sxi:Header name=&quot;Content-Type&quot; value=&quot;text/xml;charset=utf-8&quot;/&gt;
          &lt;sxi:Header name=&quot;Accept-Encoding&quot; value=&quot;gzip,deflate&quot;/&gt;
          &lt;sxi:Header name=&quot;SOAPAction&quot; value=&quot;&amp;quot;http://tempuri.org/SendSingleSMS&amp;quot;&quot;/&gt;
        &lt;/sxi:CustomHeaders&gt;
        &lt;sxi:URL&gt;http://172.25.82.95/UniserverLiveWeb/WebServices/UniserverLiveWebService.asmx&lt;/sxi:URL&gt;   
        &lt;sxi:Password/&gt;
        &lt;sxi:Username/&gt;
        &lt;sxi:RetryDelay&gt;10&lt;/sxi:RetryDelay&gt;
        &lt;sxi:Stylesheet&gt;../../usr/stylesheets/SMSOut.xsl&lt;/sxi:Stylesheet&gt;
        &lt;sxi:Timeout&gt;30&lt;/sxi:Timeout&gt;
        &lt;!-- SMSOut stylesheet for Gijima SMS --&gt;
        &lt;!--
        &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
        &lt;xsl:stylesheet version=&quot;2.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
          &lt;xsl:output method=&quot;xml&quot; indent=&quot;yes&quot;/&gt;
          &lt;xsl:template match=&quot;/&quot;&gt;
            &lt;soap:Envelope xmlns:soap=&quot;http://www.w3.org/2003/05/soap-envelope&quot; xmlns:tem=&quot;http://tempuri.org/&quot;&gt;
              &lt;soap:Header/&gt;
              &lt;soap:Body&gt;
                &lt;tem:SendSingleSMS&gt;
                  &lt;tem:PrmUserName&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;UserName&#039;]&quot;/&gt;&lt;/tem:PrmUserName&gt;
                  &lt;tem:PrmPassword&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Password&#039;]&quot;/&gt;&lt;/tem:PrmPassword&gt;
                  &lt;tem:PrmMobileNumber&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;cellNumber&#039;]&quot;/&gt;&lt;/tem:PrmMobileNumber&gt;
                  &lt;tem:PrmSMSUserRef&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;SMSUserRef&#039;]&quot;/&gt;&lt;/tem:PrmSMSUserRef&gt;
                  &lt;tem:PrmMessageText&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;message&#039;]&quot;/&gt;&lt;/tem:PrmMessageText&gt;
                &lt;/tem:SendSingleSMS&gt;
              &lt;/soap:Body&gt;
            &lt;/soap:Envelope&gt;
          &lt;/xsl:template&gt;
        &lt;/xsl:stylesheet&gt;
        --&gt;
      &lt;/Connection&gt;

      &lt;sxi:ReturnCodes&gt;
        &lt;sxi:Success&gt;
          &lt;sxi:Code&gt;Success Code&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;.*200.*&lt;/sxi:Code&gt;
        &lt;/sxi:Success&gt;
        &lt;sxi:RecoverableError&gt;
          &lt;sxi:Code&gt;Error Code&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;.*502.*&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;.*503.*&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;.*404*&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;.*Connection timed out.*+&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;.*404Not Found.*+&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;.*Message send failed.*+&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;Recoverable Error&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;Bad response:&lt;/sxi:Code&gt;
        &lt;/sxi:RecoverableError&gt;
      &lt;/sxi:ReturnCodes&gt;
    &lt;/Connector&gt;

    &lt;!-- Collect X-Notify files --&gt;
      &lt;Connector id=&quot;CollectXML&quot; type=&quot;XML&quot;&gt;
          &lt;Connection xsi:type=&quot;sxi:XML&quot;&gt;
              &lt;sxi:RetryDelay&gt;60&lt;/sxi:RetryDelay&gt;
          &lt;/Connection&gt;
          &lt;sxi:ReturnCodes&gt;
              &lt;sxi:Success&gt;
                  &lt;sxi:Code&gt;Success Code&lt;/sxi:Code&gt;
              &lt;/sxi:Success&gt;
              &lt;sxi:RecoverableError&gt;
                  &lt;sxi:Code&gt;^.*FWK005.*$&lt;/sxi:Code&gt;
              &lt;/sxi:RecoverableError&gt;
          &lt;/sxi:ReturnCodes&gt;
      &lt;/Connector&gt;

    &lt;!-- Create of X-DEC Event Doc&#039;s to Log a calls for a Heart Beat Events --&gt;
    &lt;Connector id=&quot;XML&quot; type=&quot;XML&quot;&gt;
      &lt;Connection xsi:type=&quot;sxi:XML&quot;&gt;
        &lt;sxi:Write&gt;
          &lt;sxi:SaveLocation&gt;E:\SXI\XPress\XmlOut&lt;/sxi:SaveLocation&gt;
          &lt;sxi:FileName&gt;X-DEC~CSS-XLAYER~%UNIQUE%.xml&lt;/sxi:FileName&gt;
          &lt;sxi:Stylesheet&gt;../../usr/stylesheets/CreateXDECDoc.xsl&lt;/sxi:Stylesheet&gt;
        &lt;/sxi:Write&gt;
        &lt;sxi:RetryDelay&gt;60&lt;/sxi:RetryDelay&gt;
      &lt;/Connection&gt;
      &lt;sxi:ReturnCodes&gt;
        &lt;sxi:Success&gt;
          &lt;sxi:Code&gt;Success Code&lt;/sxi:Code&gt;
        &lt;/sxi:Success&gt;
        &lt;sxi:RecoverableError&gt;
          &lt;sxi:Code&gt;^.*FWK005.*$&lt;/sxi:Code&gt;
        &lt;/sxi:RecoverableError&gt;
      &lt;/sxi:ReturnCodes&gt;
    &lt;/Connector&gt;
    
    &lt;!-- Create X-DEC Doc stylesheet for creating the X-Dec Event --&gt;
    &lt;!-- Stylesheets for CreateXDECDoc.xsl
    &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
    &lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; version=&quot;1.0&quot;&gt;
      &lt;xsl:output method=&quot;xml&quot; version=&quot;1.0&quot; omit-xml-declaration=&quot;yes&quot; indent=&quot;yes&quot;/&gt;
      &lt;xsl:template match=&quot;/&quot;&gt;
        &lt;SouthernX&gt;
          &lt;Agent_Class&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Agent_Class&#039;]&quot;/&gt;&lt;/Agent_Class&gt;
          &lt;ESMTool&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;ESMTool&#039;]&quot;/&gt;&lt;/ESMTool&gt;
          &lt;MD&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;MD&#039;]&quot;/&gt;&lt;/MD&gt;
          &lt;Agent_Instance&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Agent_Instance&#039;]&quot;/&gt;&lt;/Agent_Instance&gt;
          &lt;Server&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Server&#039;]&quot;/&gt;&lt;/Server&gt;
          &lt;Instance_Detail&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Instance_Detail&#039;]&quot;/&gt;&lt;/Instance_Detail&gt;
          &lt;Header&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Header&#039;]&quot;/&gt;&lt;/Header&gt;
          &lt;Date&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Date&#039;]&quot;/&gt;&lt;/Date&gt;
          &lt;Time&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Time&#039;]&quot;/&gt;&lt;/Time&gt;
          &lt;State&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;State&#039;]&quot;/&gt;&lt;/State&gt;
          &lt;dest&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;dest&#039;]&quot;/&gt;&lt;/dest&gt;
          &lt;UID&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;UID&#039;]&quot;/&gt;&lt;/UID&gt;
          &lt;UserData&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;UserData&#039;]&quot;/&gt;&lt;/UserData&gt;
          &lt;Client&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Client&#039;]&quot;/&gt;&lt;/Client&gt;
          &lt;Source&gt;&lt;xsl:value-of select=&quot;//*[local-name()=&#039;Source&#039;]&quot;/&gt;&lt;/Source&gt;
        &lt;/SouthernX&gt;
      &lt;/xsl:template&gt;
      --&gt;
      
    &lt;/xsl:stylesheet&gt;

    &lt;!-- Send Notification Messages to SXI Slack #clientnotifications Channel --&gt;
    &lt;Connector id=&quot;SlackConnector&quot; type=&quot;RESTWebService&quot;&gt;
      &lt;Connection xsi:type=&quot;sxi:RESTWebService&quot;&gt;
        &lt;sxi:URL&gt;https://hooks.slack.com/services/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&lt;/sxi:URL&gt;
        &lt;sxi:DataTypeToSend&gt;JSON&lt;/sxi:DataTypeToSend&gt;
        &lt;sxi:RetryDelay&gt;60&lt;/sxi:RetryDelay&gt;
      &lt;/Connection&gt;
      &lt;sxi:ReturnCodes&gt;
        &lt;sxi:Success&gt;
          &lt;sxi:Code&gt;Success Code&lt;/sxi:Code&gt;
        &lt;/sxi:Success&gt;
        &lt;sxi:RecoverableError&gt;
          &lt;sxi:Code&gt;Recoverable Error&lt;/sxi:Code&gt;
        &lt;/sxi:RecoverableError&gt;
      &lt;/sxi:ReturnCodes&gt;
    &lt;/Connector&gt;

    &lt;!-- Send Email Notification --&gt;
    &lt;Connector id=&quot;Email&quot; type=&quot;SMTP&quot;&gt;
      &lt;Connection xsi:type=&quot;sxi:SMTP&quot;&gt;
        &lt;sxi:Server&gt;165.233.54.12&lt;/sxi:Server&gt;
        &lt;sxi:User/&gt;
        &lt;sxi:Password/&gt;
        &lt;sxi:RetryDelay&gt;10&lt;/sxi:RetryDelay&gt;
        &lt;sxi:AuthType&gt;Basic&lt;/sxi:AuthType&gt;
        &lt;sxi:Port&gt;25&lt;/sxi:Port&gt;
        &lt;sxi:FromAddress&gt;noreply@ourservicedesk.com&lt;/sxi:FromAddress&gt;
      &lt;/Connection&gt;
      &lt;sxi:ReturnCodes&gt;
        &lt;sxi:Success/&gt;
        &lt;sxi:RecoverableError&gt;
          &lt;sxi:Code&gt;^Could\snot\sconnect\sto\sSMTP\shost.*&lt;/sxi:Code&gt;
          &lt;sxi:Code&gt;^.*Exception reading response.*$&lt;/sxi:Code&gt;
        &lt;/sxi:RecoverableError&gt;
      &lt;/sxi:ReturnCodes&gt;
    &lt;/Connector&gt;

    &lt;!-- XLayerDB connector --&gt; 
    &lt;Connector id=&quot;XLayerDB&quot; type=&quot;DB&quot;&gt;
      &lt;Connection xsi:type=&quot;sxi:MSSQL&quot;&gt;
        &lt;sxi:Server&gt;10.220.7.61&lt;/sxi:Server&gt;
        &lt;sxi:User&gt;sxi&lt;/sxi:User&gt;
        &lt;sxi:Password&gt;sXi_pass&lt;/sxi:Password&gt;
        &lt;sxi:RetryDelay&gt;30&lt;/sxi:RetryDelay&gt;
        &lt;sxi:DBName&gt;XLayer&lt;/sxi:DBName&gt;
        &lt;sxi:Port&gt;1433&lt;/sxi:Port&gt;
      &lt;/Connection&gt;
    &lt;sxi:ReturnCodes&gt;
      &lt;sxi:Success /&gt;
      &lt;sxi:RecoverableError&gt;
        &lt;sxi:Code&gt;.+Read timed out.+&lt;/sxi:Code&gt;
        &lt;sxi:Code&gt;.*Invalid state.+&lt;/sxi:Code&gt;
        &lt;sxi:Code&gt;.*SHUTDOWN is in progress.+&lt;/sxi:Code&gt;
        &lt;sxi:Code&gt;I/O Error: Connection reset by peer: socket write error&lt;/sxi:Code&gt;
      &lt;/sxi:RecoverableError&gt;
    &lt;/sxi:ReturnCodes&gt;
    &lt;/Connector&gt;
  &lt;/Connectors&gt;

  &lt;SignalRegistry xsi:type=&quot;sxi:SigReg.XML&quot;&gt;
    &lt;sxi:ConnectorID&gt;CollectXML&lt;/sxi:ConnectorID&gt;
    &lt;sxi:FolderPath&gt;../../XPress/XmlOut&lt;/sxi:FolderPath&gt;
    &lt;!-- There is no Action Name in the X-Notify files form X-HBChecker, we going to using Send_X_Notification for the Action  --&gt;
    &lt;sxi:ActionElement&gt;Send_X_Notification&lt;/sxi:ActionElement&gt;
    &lt;sxi:FileName&gt;^X-Notify~.*\.xml$&lt;/sxi:FileName&gt;
    &lt;sxi:PollingDelay&gt;1&lt;/sxi:PollingDelay&gt;
    &lt;sxi:DeleteProcessed&gt;no&lt;/sxi:DeleteProcessed&gt;
  &lt;/SignalRegistry&gt;

  &lt;Actions&gt;

    &lt;Action name=&quot;Send_X_Notification&quot;&gt;
      &lt;Mappings&gt;
        &lt;LogComment logLevel=&quot;TRACE&quot; Comment=&quot;################################# Collect X-Notify XML File #################################&quot;/&gt;
        &lt;Collect dataDefinition=&quot;Collect_XML_Notification&quot; connectorId=&quot;CollectXML&quot; lookupField=&quot;NA&quot; lookupValue=&quot;&quot; source=&quot;../../XPress/XmlOut&quot;/&gt;

        &lt;!-- Test if the Message is in the Database by counting the HBMessage --&gt;
        &lt;Collect dataDefinition=&quot;Cnt_Message&quot; connectorId=&quot;XLayerDB&quot; source=&quot;XNotification_Signal&quot; lookupField=&quot;HBMessage&quot; lookupValue=&quot;Message&quot; 
          customQuery=&quot;SELECT COUNT(*) as Message_Count FROM XNotification_Signal where HBMessage = &#039;~#~Message~#~&#039; &quot;&gt;

              &lt;Conditions&gt;
                &lt;Condition&gt;

                    &lt;When field=&quot;/*[local-name()=&#039;XServiceBroker&#039; ]/*[local-name()=&#039;Message_Count&#039;]&quot; operator=&quot;eq&quot; value=&quot;0&quot;&gt;

                      &lt;LogComment logLevel=&quot;TRACE&quot; Comment=&quot;################################# Write the MD and HBMessage to Database Table - XNotification_Signal #################################&quot;/&gt;

                      &lt;!-- Write the MD and HBMessage to Database Table - XNotification_Signal --&gt;
                      &lt;Create dataDefinition=&quot;Write_Notification&quot; connectorId=&quot;XLayerDB&quot; source=&quot;XNotification_Signal&quot;/&gt;

                      &lt;!-- The Get_MD is to collect the MD form the &lt;Message&gt; tag in the X-Notify XML files for the Collect to use a Custom Query to count Exiting the Recipient To Send Mail To --&gt;
                      &lt;MemoryDataManipulation dataDefinition=&quot;Get_MD&quot;/&gt;

                      &lt;!-- A Email will be send to the Default Recipient, when the Notifications is not configured the Database --&gt;
                      &lt;Collect dataDefinition=&quot;CntExitingRecipientToSendMailTo&quot; connectorId=&quot;XLayerDB&quot; source=&quot;XNotification_SendMessageConfig&quot; lookupField=&quot;HBMessage&quot; lookupValue=&quot;Message&quot;
                        customQuery=&quot;Select COUNT (*) as Recipient_Count from XNotification_SendMessageConfig where HBMessage = &#039;~#~Message~#~&#039;&quot;&gt;

                        &lt;Conditions&gt;
                          &lt;Condition&gt;

                            &lt;!-- Check if Recipient is configured in the Database --&gt;
                            &lt;When field=&quot;/*[local-name()=&#039;XServiceBroker&#039; ]/*[local-name()=&#039;Recipient_Count&#039;]&quot; operator=&quot;gt&quot; value=&quot;0&quot;&gt;

                              &lt;LogComment logLevel=&quot;TRACE&quot; Comment=&quot;################################# The Recipient is configured in the Database #################################&quot;/&gt;

                              &lt;!-- If the Recipient exists in the Database, Send a Email to Recipient using the configured Email Addresses from the Database --&gt;
                              &lt;Create dataDefinition=&quot;Send_XNotification&quot; connectorId=&quot;Email&quot; source=&quot;NA&quot; optional=&quot;no&quot; /&gt;

                              &lt;!-- The Output Memory To Log can be disabled, this is just to see what is in memory at this stage --&gt;
                              &lt;OutputMemoryToLog/&gt;

                            &lt;/When&gt;

                            &lt;Otherwise&gt;
                              &lt;!-- The Recipient does not exist in the Database, use the configured Email Addresses from the Data Definition &quot;SendEmailToDefaultRecipient&quot; to send Emails --&gt;
                              &lt;LogComment logLevel=&quot;TRACE&quot; Comment=&quot;################################# The Notification is not configured in the Database, Please configure it. #################################&quot;/&gt;
                              &lt;Create dataDefinition=&quot;SendEmailToDefaultRecipient&quot; connectorId=&quot;Email&quot; source=&quot;NA&quot;/&gt;

                              &lt;!-- The Output Memory To Log can be disabled, this is just to see what is in memory at this stage --&gt;
                              &lt;OutputMemoryToLog/&gt;

                            &lt;/Otherwise&gt;

                          &lt;/Condition&gt;
                        &lt;/Conditions&gt;

                      &lt;/Collect&gt;
                    &lt;/When&gt;

                  &lt;Otherwise&gt;
                    &lt;!-- Check what Notification will be send from the Database XNotification_Signal tabel using the HBMessage received form the X-Notify files, with a Custom Query from the Database --&gt;
                    &lt;Collect dataDefinition=&quot;GetSignalData&quot; connectorId=&quot;XLayerDB&quot; source=&quot;XNotification_Signal&quot; lookupField=&quot;HBMessage&quot; lookupValue=&quot;Message&quot;
                      customQuery=&quot;SELECT * FROM XNotification_Signal WHERE HBMessage = &#039;~#~Message~#~&#039;&quot; &gt;
                      &lt;Conditions&gt;
                        &lt;Condition&gt;

                          &lt;!-- Check if the Slack switch in the Database is &#039;ON&#039;=1 or &#039;OFF&#039;=0. To send the Slack Message the switch must be &#039;ON&#039;=1 --&gt;
                          &lt;When field=&quot;//*[local-name()=&#039;Slack&#039;]&quot; operator=&quot;eq&quot; value=&quot;1&quot;&gt;

                            &lt;!-- Set the Memory Data Manipulation for Slack Notification if we are going to Send the Slack Message to SXI #clientnotifications Channel --&gt;
                            &lt;MemoryDataManipulation dataDefinition=&quot;SendSlackMessage&quot;/&gt;
                            &lt;!-- Send a Slack Message to SXI #clientnotifications Channel --&gt;
                            &lt;LogComment Comment=&quot;################################# Notification was Send to SXI #clientnotifications Channel on Slack #################################&quot;/&gt;
                            &lt;Create dataDefinition=&quot;SendSlackMessage&quot; connectorId=&quot;SlackConnector&quot; source=&quot;POST&quot;/&gt;

                          &lt;/When&gt;

                          &lt;!-- Check if the XDec switch in the Database is &#039;ON&#039;=1 or &#039;OFF&#039;=0. To Create X-DEC file for a Event to ITSM the switch must be &#039;ON&#039;=1 --&gt;
                          &lt;When  field=&quot;//*[local-name()=&#039;XDec&#039;]&quot; operator=&quot;eq&quot; value=&quot;1&quot;&gt;
                            &lt;Collect dataDefinition=&quot;CollectClient&quot; connectorId=&quot;XLayerDB&quot; source=&quot;XNotification_Clients&quot; lookupField=&quot;Server&quot; lookupValue=&quot;MD&quot;&gt;

                              &lt;Conditions&gt;
                                &lt;Condition&gt;

                                  &lt;When field=&quot;//*[local-name()=&#039;Server&#039;]&quot; operator=&quot;DoesNotMatch&quot; value=&quot;0&quot;&gt;

                                    &lt;!-- The Output Memory To Log can be disabled, this is just to see what is in memory at this stage --&gt;
                                    &lt;OutputMemoryToLog/&gt;

                                    &lt;LogComment Comment=&quot;################################# The XDec Switch in the Database is On to Create the X-DEC #################################&quot;/&gt;
                                    &lt;!-- The X-DEC doc will be created here to log a call in to ITSM or to Resolve the calls in ITSM --&gt;
                                    &lt;Create dataDefinition=&quot;Create_XDEC&quot; connectorId=&quot;XML&quot; source=&quot;E:\SXI\XPress\XmlOut&quot;/&gt;

                                  &lt;/When&gt;

                                  &lt;Otherwise&gt;
                                    &lt;LogComment Comment=&quot;################################# The MD Doesn&#039;t exist in the Database!! #################################&quot;/&gt;
                                  &lt;/Otherwise&gt;

                                &lt;/Condition&gt;
                              &lt;/Conditions&gt;

                            &lt;/Collect&gt;
                          &lt;/When&gt;

                          &lt;!-- Check if the SMS switch in the Database is &#039;ON&#039;=1 or &#039;OFF&#039;=0. To Send a SMS the switch must be &#039;ON&#039;=1. --&gt;                          
                          &lt;When field=&quot;//*[local-name()=&#039;SMS&#039;]&quot; operator=&quot;eq&quot; value=&quot;1&quot;&gt;

                            &lt;ApplyStyleSheetToMemoryContents  stylesheetFolder=&quot;E:\SXI\usr\stylesheets\&quot; stylesheet=&quot;removeXMLUnprintableChars.xsl&quot;&gt;&lt;/ApplyStyleSheetToMemoryContents&gt;
                            &lt;LogComment Comment=&quot;################################# The SMS Database Switch is On to Send the SMS #################################&quot;/&gt;
                            &lt;Collect dataDefinition=&quot;CollectSMS&quot; connectorId=&quot;XLayerDB&quot; source=&quot;XNotification_SendMessageConfig&quot; lookupField=&quot;HBMessage&quot; lookupValue=&quot;HBMessage&quot;
                              customQuery=&quot;SELECT * FROM XNotification_SendMessageConfig WHERE HBMessage = &#039;~#~HBMessage~#~&#039;&quot; /&gt;

                            &lt;!-- Send a SMS to the CellNumber from the Database by Posting to the SMS WEB Service --&gt;
                            &lt;Create dataDefinition=&quot;SendSMS&quot; connectorId=&quot;SMSWEBConnector&quot; source=&quot;POST&quot;/&gt;

                          &lt;/When&gt;

                          &lt;!-- Check if the Email switch in the Database is &#039;ON&#039;=1 or &#039;OFF&#039;=0. To Send a Email to Recipients the switch must be &#039;ON&#039;=1. --&gt;  
                          &lt;When field=&quot;//*[local-name()=&#039;mEmail&#039;]&quot; operator=&quot;eq&quot; value=&quot;1&quot;&gt;

                            &lt;LogComment Comment=&quot;################################# The Email Database Switch is On to Send the Email #################################&quot;/&gt;
                            &lt;Collect dataDefinition=&quot;CntExitingRecipientToSendMailTo&quot; connectorId=&quot;XLayerDB&quot; source=&quot;XNotification_SendMessageConfig&quot; lookupField=&quot;HBMessage&quot; lookupValue=&quot;HBMessage&quot;
                              customQuery=&quot;Select COUNT (*) as Recipient_Count from XNotification_SendMessageConfig where HBMessage = &#039;~#~HBMessage~#~&#039;&quot;&gt;

                              &lt;Conditions&gt;
                                &lt;Condition&gt;

                                  &lt;!-- Check the number of Recipients returned from the Databse XNotification_SendMessageConfig table, a Email will be send to each Recipient --&gt; 
                                  &lt;When field=&quot;/*[local-name()=&#039;XServiceBroker&#039; ]/*[local-name()=&#039;Recipient_Count&#039;]&quot; operator=&quot;gt&quot; value=&quot;0&quot;&gt;

                                    &lt;!-- Collect the Email addresses form the Database to send notifications to the Recipients --&gt;
                                    &lt;Collect dataDefinition=&quot;GetPeopleToSendNotificationDetails&quot; connectorId=&quot;XLayerDB&quot; source=&quot;XNotification_SendMessageConfig&quot; lookupField=&quot;MD&quot; lookupValue=&quot;MD&quot;
                                      customQuery=&quot;SELECT * from XNotification_SendMessageConfig where HBMessage = &#039;~#~HBMessage~#~&#039;&quot;/&gt;

                                    &lt;LogComment logLevel=&quot;TRACE&quot; Comment=&quot;################################# Send Notification Message to Email - ~#~Recipient~#~ #################################&quot;/&gt;
                                    &lt;!-- Send Email to collected Recipients addresses --&gt;
                                    &lt;Create dataDefinition=&quot;Send_XNotification&quot; connectorId=&quot;Email&quot; source=&quot;NA&quot; optional=&quot;no&quot; /&gt;
                                  &lt;/When&gt;

                                  &lt;Otherwise&gt;
                                    &lt;!-- The Recipient does not exist in the Database, use the configured Email Addresses from the Data Definition &quot;SendEmailToDefaultRecipient&quot; to send Emails --&gt;
                                    &lt;LogComment logLevel=&quot;TRACE&quot; Comment=&quot;################################# Send Notification Message to Default User #################################&quot;/&gt;
                                    &lt;Create dataDefinition=&quot;SendEmailToDefaultRecipient&quot; connectorId=&quot;Email&quot; source=&quot;NA&quot;/&gt;
                                  &lt;/Otherwise&gt;

                                &lt;/Condition&gt;
                              &lt;/Conditions&gt;

                            &lt;/Collect&gt;
                          &lt;/When&gt;

                        &lt;/Condition&gt;
                      &lt;/Conditions&gt;
                    &lt;/Collect&gt;
                  &lt;/Otherwise&gt;
                &lt;/Condition&gt;
               &lt;/Conditions&gt;
        &lt;/Collect&gt;
       &lt;/Mappings&gt;
      &lt;/Action&gt;

  &lt;/Actions&gt;

  &lt;sxi:DataDefinitions&gt;

    &lt;!-- Collect X-Notify XML file --&gt;
    &lt;sxi:DataDefinition name=&quot;Collect_XML_Notification&quot;&gt;
      &lt;sxi:Fields&gt;

        &lt;sxi:Field name=&quot;//*[local-name()=&#039;Message&#039;]&quot;&gt;
          &lt;sxi:OutputField&gt;Message&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        
        &lt;!-- MD is collected form the &lt;Message&gt; tag in the X-Notify XML files --&gt;
        &lt;sxi:Field name=&quot;//*[local-name()=&#039;Message&#039;]&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Split&gt;
              &lt;sxi:Delimiter&gt;\sfor\s&lt;/sxi:Delimiter&gt;
              &lt;sxi:OutputFields&gt;
                &lt;sxi:OutputField index=&quot;1&quot;&gt;TempMD&lt;/sxi:OutputField&gt;
              &lt;/sxi:OutputFields&gt;
            &lt;/sxi:Split&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Omit&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;sxi:Field name=&quot;TempMD&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Split&gt;
              &lt;sxi:Delimiter&gt;\shas\s| &lt;/sxi:Delimiter&gt;
              &lt;sxi:OutputFields&gt;
                &lt;sxi:OutputField index=&quot;0&quot;&gt;mMD&lt;/sxi:OutputField&gt;
              &lt;/sxi:OutputFields&gt;
            &lt;/sxi:Split&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Omit&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;sxi:Field name=&quot;mMD&quot;&gt;
          &lt;sxi:OutputField&gt;MD&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

      &lt;/sxi:Fields&gt;

    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Define Message Count --&gt;
    &lt;sxi:DataDefinition name=&quot;Cnt_Message&quot;&gt;
      &lt;sxi:Fields&gt;

        &lt;sxi:Field name=&quot;Message_Count&quot;&gt;
          &lt;sxi:OutputField&gt;Message_Count&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Write X-Notify XML files collected to the Database table --&gt;
    &lt;sxi:DataDefinition name=&quot;Write_Notification&quot;&gt;
      &lt;sxi:Fields&gt;

        &lt;sxi:Field name=&quot;//*[local-name()=&#039;Message&#039;]&quot;&gt;
          &lt;sxi:OutputField&gt;HBMessage&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- MD is collect form the &lt;Message&gt; tag in the X-Notify XML files --&gt;
        &lt;!-- &lt;Message&gt;A XPress/Dispatch Heartbeat for NDCVCFGMGRP01 has FAILED&lt;/Message&gt; --&gt;
        &lt;sxi:Field name=&quot;//*[local-name()=&#039;Message&#039;]&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Split&gt;
              &lt;sxi:Delimiter&gt;\sfor\s&lt;/sxi:Delimiter&gt;
              &lt;sxi:OutputFields&gt;
                &lt;sxi:OutputField index=&quot;1&quot;&gt;TempMD&lt;/sxi:OutputField&gt;
                &lt;!-- TempMD = &quot;NDCVCFGMGRP01 has FAILED&quot; --&gt;                
              &lt;/sxi:OutputFields&gt;
            &lt;/sxi:Split&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Omit&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;sxi:Field name=&quot;TempMD&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Split&gt;
              &lt;sxi:Delimiter&gt;\shas\s| &lt;/sxi:Delimiter&gt;
              &lt;sxi:OutputFields&gt;
                &lt;sxi:OutputField index=&quot;0&quot;&gt;mMD&lt;/sxi:OutputField&gt;
                &lt;!-- mMD = &quot;NDCVCFGMGRP01&quot; --&gt;
              &lt;/sxi:OutputFields&gt;
            &lt;/sxi:Split&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Omit&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;!-- MD = &quot;NDCVCFGMGRP01&quot; --&gt;
        &lt;sxi:Field name=&quot;mMD&quot;&gt;
          &lt;sxi:OutputField&gt;MD&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Email&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;1&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Email&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Strip out the MD from the Message --&gt;
    &lt;!-- &lt;Message&gt;A XPress/Dispatch Heartbeat for NDCVCFGMGRP01 has FAILED&lt;/Message&gt; --&gt;
    &lt;sxi:DataDefinition name=&quot;Get_MD&quot;&gt;
      &lt;sxi:Fields&gt;
        &lt;sxi:Field name=&quot;//*[local-name()=&#039;Message&#039;]&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Split&gt;
              &lt;sxi:Delimiter&gt;\sfor\s&lt;/sxi:Delimiter&gt;
              &lt;sxi:OutputFields&gt;
                &lt;sxi:OutputField index=&quot;1&quot;&gt;TempMD&lt;/sxi:OutputField&gt;
                &lt;!-- TempMD = &quot;NDCVCFGMGRP01 has FAILED&quot; --&gt; 
              &lt;/sxi:OutputFields&gt;
            &lt;/sxi:Split&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Omit&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;sxi:Field name=&quot;TempMD&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Split&gt;
              &lt;sxi:Delimiter&gt;\shas\s| &lt;/sxi:Delimiter&gt;
              &lt;sxi:OutputFields&gt;
                &lt;sxi:OutputField index=&quot;0&quot;&gt;mMD&lt;/sxi:OutputField&gt;
                &lt;!-- mMD = &quot;NDCVCFGMGRP01&quot; --&gt;
              &lt;/sxi:OutputFields&gt;
            &lt;/sxi:Split&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Omit&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;!-- MD = &quot;NDCVCFGMGRP01&quot; --&gt;        
        &lt;sxi:Field name=&quot;mMD&quot;&gt;
          &lt;sxi:OutputField&gt;MD&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Count Exiting Recipients to send mail to --&gt;
    &lt;sxi:DataDefinition name=&quot;CntExitingRecipientToSendMailTo&quot;&gt;
      &lt;sxi:Fields&gt;

        &lt;sxi:Field name=&quot;Recipient_Count&quot;&gt;
          &lt;sxi:OutputField&gt;Recipient_Count&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Send XNotification mails to the recipients form the Database --&gt;
    &lt;sxi:DataDefinition name=&quot;Send_XNotification&quot;&gt;
      &lt;sxi:Fields&gt;

        &lt;sxi:Field name=&quot;Recipient&quot;&gt;
          &lt;sxi:OutputField datatype=&quot;recipients&quot;&gt;To&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Message&quot;&gt;
          &lt;sxi:OutputField&gt;Subject&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Body&quot;&gt;
          &lt;sxi:OutputField&gt;Body&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;cellNumber&quot;&gt;
          &lt;sxi:OutputField&gt;cellNumber&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;FullName&quot;&gt;
          &lt;sxi:OutputField&gt;FullName&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Send Email To Default Email recipients --&gt;
    &lt;!-- A Email will be send to the Default Recipient, when the Notifications is not configured the Database --&gt;
    &lt;sxi:DataDefinition name=&quot;SendEmailToDefaultRecipient&quot;&gt;
      &lt;sxi:Fields&gt;

        &lt;sxi:Field name=&quot;EmailAddress&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;!-- Add Default the Email recipients that needs to be notified when the Notifications is not configured in the Database --&gt;
            &lt;sxi:Default&gt;stephan.booyzen@sxi.co.za,sibusiso.skosana@sxi.co.za&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField datatype=&quot;recipients&quot;&gt;To&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Message&quot;&gt;
          &lt;sxi:OutputField&gt;Subject&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Body&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Concatenation&gt;
              &lt;sxi:Delimiter/&gt;
              &lt;sxi:Fields&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;Good day,&amp;#xD;&amp;#xD;&lt;/sxi:Field&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;Please take note that the Notification is not configured in the Database.&lt;/sxi:Field&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;&amp;#xD;&amp;quot;&lt;/sxi:Field&gt;
                &lt;sxi:Field&gt;Message&lt;/sxi:Field&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;&amp;quot;&lt;/sxi:Field&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;&amp;#xD;&lt;/sxi:Field&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;Please configure the Notification in the XLayer Database.&amp;#xD;&lt;/sxi:Field&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;&amp;#xD;&lt;/sxi:Field&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;Kind regards,&amp;#xD;&lt;/sxi:Field&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;SXI Team&lt;/sxi:Field&gt;
              &lt;/sxi:Fields&gt;
            &lt;/sxi:Concatenation&gt;
            &lt;sxi:Substitute&gt;
              &lt;sxi:Find&gt;null&lt;/sxi:Find&gt;
              &lt;sxi:Replace&gt;&lt;/sxi:Replace&gt;
            &lt;/sxi:Substitute&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Body&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Collect Signal Data from Database --&gt;
    &lt;sxi:DataDefinition name=&quot;GetSignalData&quot;&gt;
      &lt;sxi:Fields&gt;
        &lt;sxi:Field name=&quot;Id&quot;&gt;
          &lt;sxi:OutputField&gt;Id&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;MD&quot;&gt;
          &lt;sxi:OutputField&gt;MD&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;HBMessage&quot;&gt;
          &lt;sxi:OutputField&gt;HBMessage&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;XDec&quot;&gt;
          &lt;sxi:OutputField&gt;XDec&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;SMS&quot;&gt;
          &lt;sxi:OutputField&gt;SMS&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Email&quot;&gt;
          &lt;sxi:OutputField&gt;mEmail&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Slack&quot;&gt;
          &lt;sxi:OutputField&gt;Slack&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Set variable for the XNotification Message to Slack --&gt;
    &lt;sxi:DataDefinition name=&quot;SendSlackMessage&quot;&gt;
      &lt;sxi:Fields&gt;
        &lt;sxi:Field name=&quot;//*[local-name()=&#039;Message&#039;]&quot;&gt;
          &lt;sxi:Rules/&gt;
          &lt;sxi:OutputField&gt;MESSAGE&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;TempMessage&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Concatenation&gt;
              &lt;sxi:Delimiter/&gt;
              &lt;sxi:Fields&gt;
                &lt;!-- The static value is to know form what Client the Notification is coming from in the SXI Slack #clientnotifications Channel --&gt;
                &lt;sxi:Field staticValue=&quot;yes&quot;&gt;BCX Heart Beat Notification  - &lt;/sxi:Field&gt;
                &lt;sxi:Field&gt;MESSAGE&lt;/sxi:Field&gt;
              &lt;/sxi:Fields&gt;
            &lt;/sxi:Concatenation&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;text&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Collect Server and Client from Database --&gt;
    &lt;sxi:DataDefinition name=&quot;CollectClient&quot;&gt;
      &lt;sxi:Fields&gt;

        &lt;sxi:Field name=&quot;Server&quot;&gt;
          &lt;sxi:OutputField&gt;Server&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Client&quot;&gt;
          &lt;sxi:OutputField&gt;Client&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Create a Event doc to log a call in ITSM --&gt;
    &lt;sxi:DataDefinition name=&quot;Create_XDEC&quot;&gt;
      &lt;sxi:Fields&gt;

        &lt;!-- &lt;Agent_Class&gt;X-HBChecker&lt;/Agent_Class&gt; --&gt;
        &lt;sxi:Field name=&quot;Agent_Class&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;X-HBChecker&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Agent_Class&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- &lt;ESMTool&gt;X-HBChecker&lt;/ESMTool&gt; --&gt;
        &lt;sxi:Field name=&quot;ESMTool&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;X-HBChecker&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;ESMTool&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- &lt;MD&gt;CSS-XLAYER&lt;/MD&gt; --&gt;
        &lt;sxi:Field name=&quot;TempMD&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;CSS-XLAYER&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;MD&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- Agent_Instance - &lt;Message&gt;XPress/Dispatch Heartbeat has failed for $$$$$$$$($$$$$$ Server @ $$$$$$)&lt;/Message&gt; --&gt;
        &lt;sxi:Field name=&quot;Message&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Split&gt;
              &lt;sxi:Delimiter&gt;\shas\s&lt;/sxi:Delimiter&gt;
              &lt;sxi:OutputFields&gt;
                &lt;sxi:OutputField index=&quot;0&quot;&gt;Agent_Instance&lt;/sxi:OutputField&gt;
              &lt;/sxi:OutputFields&gt;
            &lt;/sxi:Split&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Omit&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- Server --&gt;
        &lt;sxi:Field name=&quot;mMD&quot;&gt;
          &lt;sxi:OutputField&gt;Server&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Message&quot;&gt;
          &lt;sxi:OutputField&gt;Instance_Detail&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Header&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;X-CALL&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Header&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Date&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;!-- &lt;Date&gt;01/06/2020&lt;/Date&gt; --&gt;
            &lt;sxi:InsertDateTime OutputDateFormat=&quot;MM/dd/yyyy&quot;/&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Date&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Time&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:InsertDateTime OutputDateFormat=&quot;HH:mm:ss&quot;/&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Time&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Message&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Split&gt;
              &lt;sxi:Delimiter&gt;\shas\s&lt;/sxi:Delimiter&gt;
              &lt;sxi:OutputFields&gt;
                &lt;sxi:OutputField index=&quot;1&quot;&gt;State&lt;/sxi:OutputField&gt;
              &lt;/sxi:OutputFields&gt;
            &lt;/sxi:Split&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;State&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- &lt;Destination&gt;127.0.0.1&lt;/Destination&gt; --&gt;
        &lt;sxi:Field name=&quot;Destination&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;127.0.0.1&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;dest&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- UID - Concatenation of (MD, Server, AgentClass, AgentInstance) --&gt;
        &lt;sxi:Field name=&quot;tmpUID0&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Concatenation&gt;
              &lt;sxi:Delimiter/&gt;
              &lt;sxi:Fields&gt;
                &lt;sxi:Field&gt;MD&lt;/sxi:Field&gt;
                &lt;sxi:Field&gt;Server&lt;/sxi:Field&gt;
                &lt;sxi:Field&gt;Agent_Class&lt;/sxi:Field&gt;
                &lt;sxi:Field&gt;Agent_Instance&lt;/sxi:Field&gt;
              &lt;/sxi:Fields&gt;
            &lt;/sxi:Concatenation&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;tmpUID1&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;!-- Generate MD5Hash of above Concatenation --&gt;
        &lt;sxi:Field name=&quot;tmpUID1&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:MD5Hash/&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;UID&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Message&quot;&gt;
          &lt;sxi:OutputField&gt;UserData&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- &lt;Action&gt;Create&lt;/Action&gt; --&gt;
        &lt;sxi:Field name=&quot;Action&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;Create&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Action&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Client&quot;&gt;
          &lt;sxi:OutputField&gt;Client&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- &lt;Source&gt;X-Notify&lt;/Source&gt; --&gt;
        &lt;sxi:Field name=&quot;Source&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;X-HBChecker&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Source&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Collect Cell Number to send the SMS to --&gt;
    &lt;sxi:DataDefinition name=&quot;CollectSMS&quot;&gt;
      &lt;sxi:Fields&gt;
        &lt;sxi:Field name=&quot;//*[local-name()=&#039;cellNumber&#039;]&quot;&gt;
          &lt;sxi:Rules/&gt;
          &lt;sxi:OutputField&gt;cellNumber&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;sxi:Field name=&quot;//*[local-name()=&#039;message&#039;]&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Length&gt;160&lt;/sxi:Length&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;message&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Send SMS message --&gt;
    &lt;sxi:DataDefinition name=&quot;SendSMS&quot;&gt;
      &lt;sxi:Fields&gt;
        &lt;sxi:Field name=&quot;UserName&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;xlayer&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;UserName&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;sxi:Field name=&quot;Password&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Default&gt;xlayer&lt;/sxi:Default&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Password&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;sxi:Field name=&quot;cellNumber&quot;&gt;
          &lt;sxi:Rules /&gt;
          &lt;sxi:OutputField&gt;cellNumber&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
        &lt;sxi:Field name=&quot;message&quot;&gt;
          &lt;sxi:Rules&gt;
            &lt;sxi:Length&gt;160&lt;/sxi:Length&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;message&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

    &lt;!-- Define EMail Address form the Database --&gt;
    &lt;sxi:DataDefinition name=&quot;GetPeopleToSendNotificationDetails&quot;&gt;
      &lt;sxi:Fields&gt;
        &lt;sxi:Field name=&quot;MD&quot;&gt;
          &lt;sxi:OutputField&gt;MD&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;FullName&quot;&gt;
          &lt;sxi:OutputField&gt;FullName&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;CellNumber&quot;&gt;
          &lt;sxi:OutputField&gt;CellNumber&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Recipient&quot;&gt;
          &lt;sxi:OutputField&gt;Recipient&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;!-- Body of the Mail --&gt;
        &lt;!-- &quot;~#~&quot; is used in the data in the Database to create a nice the mail massage to the Recipient by replacing the &quot;~#~&quot; with &quot;&amp;#xD;&quot; carriage-return using the Substitute rule --&gt;
        &lt;!-- Example data from the Database: &quot;Good day,~#~~#~XPress/Dispatch Heartbeat has failed for ServerName(Event Server @ The Client)~#~~#~Yours in Service,~#~ITSM&quot; --&gt;
        &lt;!-- The Body of the Mail will look like the following when receiving the Mail Notification --&gt;
        &lt;!-- 
             Good day,
          
             XPress/Dispatch Heartbeat has failed for ServerName(Event Server @ The Client)
          
             Yours in Service,
             ITSM 
        --&gt;
        &lt;sxi:Field name=&quot;Body&quot;&gt;
          &lt;sxi:Rules&gt; 
            &lt;sxi:Substitute&gt;
              &lt;sxi:Find&gt;~#~&lt;/sxi:Find&gt;
              &lt;sxi:Replace&gt;&amp;#xD;&lt;/sxi:Replace&gt;
            &lt;/sxi:Substitute&gt;
          &lt;/sxi:Rules&gt;
          &lt;sxi:OutputField&gt;Body&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;

        &lt;sxi:Field name=&quot;Subject&quot;&gt;
          &lt;sxi:OutputField&gt;Subject&lt;/sxi:OutputField&gt;
        &lt;/sxi:Field&gt;
      &lt;/sxi:Fields&gt;
    &lt;/sxi:DataDefinition&gt;

  &lt;/sxi:DataDefinitions&gt;
&lt;/Configuration&gt;</code></pre></div><p>Please feel free to test this, if you have any better suggestion please share it here with us.<br />Zwido, Sibu and Steph.</p>]]></description>
			<author><![CDATA[dummy@example.com (StephanB)]]></author>
			<pubDate>Mon, 06 Jul 2020 14:30:33 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=113&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Blueprints]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=91&amp;action=new</link>
			<description><![CDATA[<p>The blueprint for <a href="http://www.freshdesk.com" rel="nofollow">FreshDesk Service Desk</a> has been created.</p><p>You can find the required files in the SXI Blueprints Repo.</p><p>This points to a Demo <a href="http://sxi.freshdesk.com" rel="nofollow">SXI Freshdesh service desk</a> system that you can find <a href="http://sxi.freshdesk.com" rel="nofollow">here</a>.&#160; More details can be found in the Readme.txt file.</p>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Thu, 15 Aug 2019 14:50:44 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=91&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[XLayer Mappings or Stored Proc?]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=74&amp;action=new</link>
			<description><![CDATA[<p><strong>This really only applies if we have access to create a stored proc on a database.</strong></p><p>The question si a matter of style and maintainability.</p><p>Often times we need to check if a record exists in a table.&#160; If it exists we need to use that records ID however if there is no record in the table then we need to insert it and return the ID of the newly inserted record.&#160; </p><p>Assume we have a table called <strong>locations</strong> the table is made up of the following columns.&#160; </p><ol class="decimal"><li><p>id</p></li><li><p>location</p></li><li><p>address</p></li></ol><p>Let&#039;s look at 2 ways to do this.</p><br /><h5>Using XLayer Mappings</h5><ol class="decimal"><li><p>We start of by collecting the location and address from the source trigger (not discussed here)</p></li><li><p>Consider the following Configuration (without extensive exception handling) to check if the record exists and insert it if it doesn&#039;t.</p><div class="codebox"><pre class="vscroll"><code>&lt;!-- Check if Location already exists --&gt;
&lt;Collect dataDefinition=&quot;GetID&quot; connectorId=&quot;MYSQLCon&quot; source=&quot;locations&quot; lookupField=&quot;location&quot; lookupValue=&quot;mLocation&quot;&gt;
  &lt;Conditions&gt;
    &lt;Condition&gt;
      &lt;When value=&quot;false&quot;&gt;
        &lt;LogComment Comment=&quot;A record could NOT be found ... I will perform an insert now!&quot;/&gt;
        &lt;!-- Perform the INSERT here but then I need to get the ID later --&gt;
        &lt;Create dataDefinition=&quot;InsertLocation&quot; connectorId=&quot;MYSQLCon&quot; source=&quot;locations&quot;&gt;
          &lt;Conditions&gt;
            &lt;Condition&gt;
              &lt;When value=&quot;True&quot;&gt;
                &lt;Collect dataDefinition=&quot;GetID&quot; connectorId=&quot;MYSQLCon&quot; source=&quot;locations&quot; lookupField=&quot;location&quot; lookupValue=&quot;mLocation&quot;&gt;
                  &lt;Conditions&gt;
                    &lt;Condition&gt;
                      &lt;When field=&quot;mId&quot; operator=&quot;Matches&quot; value=&quot;^\d*$&quot;&gt;
                        &lt;LogComment Comment=&quot;The ID that was returned is &amp;gt;~#~mId~#~&amp;lt;&quot;/&gt;
                      &lt;/When&gt;
                      &lt;Otherwise&gt;
                        &lt;LogComment Comment=&quot;Exception Handling stuff to go here.&quot;/&gt;
                      &lt;/Otherwise&gt;
                    &lt;/Condition&gt;
                  &lt;/Conditions&gt;
                &lt;/Collect&gt;
              &lt;/When&gt;
              &lt;Otherwise&gt;
                &lt;LogComment Comment=&quot;Exception Handling stuff to go here.&quot;/&gt;
              &lt;/Otherwise&gt;
            &lt;/Condition&gt;
          &lt;/Conditions&gt;
        &lt;/Create&gt;
      &lt;/When&gt;
      &lt;Otherwise&gt;
        &lt;LogComment Comment=&quot;The record exists ID = &amp;gt;~#~mId~#~&amp;lt;&quot;/&gt;
      &lt;/Otherwise&gt;
    &lt;/Condition&gt;
  &lt;/Conditions&gt;  
&lt;/Collect&gt;</code></pre></div></li><li><p>This is cumbersome as we need to do the select (Collection of the ID field) <strong>twice</strong>.&#160; If the record does not exist in the table which we test by doing the first Collect we insert the record using a Create and then have to do the same Collect again to get the newly created records ID.</p></li><li><p>The next issue is that for every mapping we should be doing exception handling.</p></li></ol><h5>Using a SQL Stored Procedure</h5><ol class="decimal"><li><p>This XLayer configuration calls a stored procedure.&#160; As you can see the configuration is far simpler and cleaner.</p><div class="codebox"><pre><code>&lt;Collect connectorId=&quot;MYSQLCon&quot; source=&quot;locations&quot; lookupField=&quot;na&quot; lookupValue=&quot;&quot; 
    customQuery=&quot;call CheckLocations(&amp;quot;~#~mLocation~#~&amp;quot;, &amp;quot;~#~mAddress~#~&amp;quot;);&quot;&gt;
  &lt;Conditions&gt;
    &lt;Condition&gt;
      &lt;When value=&quot;true&quot;&gt;
        &lt;LogComment Comment=&quot;The ID that was returned is &amp;gt;~#~mId~#~&amp;lt;&quot;/&gt;  
      &lt;/When&gt;
      &lt;Otherwise&gt;
        &lt;LogComment Comment=&quot;Exception Handling stuff to go here.&quot;/&gt;
      &lt;/Otherwise&gt;
    &lt;/Condition&gt;
  &lt;/Conditions&gt;
&lt;/Collect&gt;</code></pre></div></li><li><p>The stored proc that we create in MYSQL looks as follows:</p><div class="codebox"><pre><code>CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckLocations`(
	in sLocation varchar(100),
    in sAddress varchar(255)
)
BEGIN
	IF (SELECT 1 = 1 FROM locations WHERE location = sLocation) THEN
		BEGIN
			SELECT id FROM locations WHERE location = sLocation;
		END;
	ELSE
		BEGIN
			INSERT INTO locations (location, address) VALUES(sLocation, sAddress);
			SELECT LAST_INSERT_ID() AS id;
		END;
	END IF;    
END</code></pre></div></li><li><p>As you can see this looks far more elegant and straight forward to maintain.</p></li></ol><p>Let me know your thoughts on this strategy.&#160; As mentioned at the outset this can only be done if we have access to create a stored procedure on the database.&#160; However this does offer some interesting options going forward should we need to validate or obtain supporting data.</p>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Tue, 26 Feb 2019 21:45:16 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=74&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[Unable to substitute values containing \ (backslash) in a custom query]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=72&amp;action=new</link>
			<description><![CDATA[<p>Found this very helpful, thanks Kev!</p>]]></description>
			<author><![CDATA[dummy@example.com (RuanO)]]></author>
			<pubDate>Thu, 21 Feb 2019 00:43:01 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=72&amp;action=new</guid>
		</item>
		<item>
			<title><![CDATA[AccessControlException MBeanTrustPermission]]></title>
			<link>https://www.xlayer.co.za/forum/viewtopic.php?id=23&amp;action=new</link>
			<description><![CDATA[<p>If you copy the permission line (permission javax.management.MBeanTrustPermission “register”;) from this forum into the java.policy file you will have to change the Unicode quotes represented in this forum, to ASCII quotes after the copy, otherwise the line will be ignored and you will still get mbean registration error.</p><p>For additional information on java management beans see <a href="https://en.wikipedia.org/wiki/Java_Management_Extensions" rel="nofollow">https://en.wikipedia.org/wiki/Java_Mana … Extensions</a></p>]]></description>
			<author><![CDATA[dummy@example.com (SeanR)]]></author>
			<pubDate>Wed, 21 Nov 2018 09:41:06 +0000</pubDate>
			<guid>https://www.xlayer.co.za/forum/viewtopic.php?id=23&amp;action=new</guid>
		</item>
	</channel>
</rss>
