<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=OnCreatePageOffHours</id>
	<title>OnCreatePageOffHours - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=OnCreatePageOffHours"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OnCreatePageOffHours&amp;action=history"/>
	<updated>2026-08-22T14:09:03Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=OnCreatePageOffHours&amp;diff=26334&amp;oldid=prev</id>
		<title>Tharn at 18:24, 13 August 2016</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OnCreatePageOffHours&amp;diff=26334&amp;oldid=prev"/>
		<updated>2016-08-13T18:24:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:24, 13 August 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Custom Condition:&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Custom Condition:&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nowiki&lt;/del&gt;&amp;gt;# These first 4 variables correspond to the start and stop of&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;# These first 4 variables correspond to the start and stop of&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  # business days and hours. The 5th variable is the email&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  # business days and hours. The 5th variable is the email&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  # address of the other system that is forwarding messages.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  # address of the other system that is forwarding messages.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l50&quot;&gt;Line 50:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 51:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  return 1; ## It&amp;#039;s OFF Hours during the work week&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  return 1; ## It&amp;#039;s OFF Hours during the work week&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;nowiki&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pre&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Code Explanation:&amp;#039;&amp;#039;&amp;#039; The first 5 variables allow you to define the time periods that is considered ON hours. It allows you to define what days are considered business days. Lastly it lets define from what email address the other system is sending requests.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Code Explanation:&amp;#039;&amp;#039;&amp;#039; The first 5 variables allow you to define the time periods that is considered ON hours. It allows you to define what days are considered business days. Lastly it lets define from what email address the other system is sending requests.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-2388:rev-26334:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Tharn</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=OnCreatePageOffHours&amp;diff=2388&amp;oldid=prev</id>
		<title>Admin: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OnCreatePageOffHours&amp;diff=2388&amp;oldid=prev"/>
		<updated>2016-04-06T20:15:49Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Purpose:&amp;#039;&amp;#039;&amp;#039; Our company&amp;#039;s helpdesk uses a different email system and need to assign tickets to us but we use RT. The other system will send an email to our RT system but we need to know if it is OFF Hours so we can get paged. This script tests to see if a ticket is created (sent in by) the external system and if it&amp;#039;s OFF hours it will send an email to our pager.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Author:&amp;#039;&amp;#039;&amp;#039; macnlos AT gmail DOT com - I&amp;#039;m on the RT Users List&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Requirement:&amp;#039;&amp;#039;&amp;#039; This scrip uses the [[SendEmailAction]] script which allows us to send to any external email address. Our template is based on the example in this scrip.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Description:&amp;#039;&amp;#039;&amp;#039; Helpdesk Off Hours Pager&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Condition:&amp;#039;&amp;#039;&amp;#039; User Defined&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Action:&amp;#039;&amp;#039;&amp;#039; Send Email &amp;amp;lt;--- this is the [[SendEmailAction]] scrip&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Template:&amp;#039;&amp;#039;&amp;#039; Global template: Notifypager&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;State:&amp;#039;&amp;#039;&amp;#039; [[TransactionCreate]]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Custom Condition:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;# These first 4 variables correspond to the start and stop of&lt;br /&gt;
 # business days and hours. The 5th variable is the email&lt;br /&gt;
 # address of the other system that is forwarding messages.&lt;br /&gt;
 my $start_hr = 6;&lt;br /&gt;
 my $end_hr = 17;&lt;br /&gt;
 my $start_day = 1;&lt;br /&gt;
 my $end_day = 5;&lt;br /&gt;
 my $from_address = &amp;#039;email@othersystem.com&amp;#039;;&lt;br /&gt;
 &lt;br /&gt;
 # Bypass if this is not being created&lt;br /&gt;
 if ($self-&amp;amp;gt;TransactionObj-&amp;amp;gt;Type ne &amp;quot;Create&amp;quot;) {&lt;br /&gt;
   return 0; # This is an update transaction&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # Get who created this ticket and exit if it doesn&amp;#039;t&lt;br /&gt;
 # match the system address from above&lt;br /&gt;
 my $requestor_address = lc($self-&amp;amp;gt;TicketObj-&amp;amp;gt;RequestorAddresses);&lt;br /&gt;
 if ($requestor_address ne $from_address) {&lt;br /&gt;
   return 0; ## Not from Unicenter&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # Parse out the current time the check if it is on or off hours.&lt;br /&gt;
 my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst) = localtime time();&lt;br /&gt;
 if (($wday &amp;amp;lt; $start_day) || ($wday &amp;amp;gt; $end_day)) {&lt;br /&gt;
   return 1; ## It&amp;#039;s not in the work week and is OFF Hours&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 if (($hour &amp;amp;gt;= $start_hr) &amp;amp;amp;&amp;amp;amp; ($hour &amp;amp;lt;= $end_hr)) {&lt;br /&gt;
   return 0; ## It&amp;#039;s with business hours (ON Hours)&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 return 1; ## It&amp;#039;s OFF Hours during the work week&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Code Explanation:&amp;#039;&amp;#039;&amp;#039; The first 5 variables allow you to define the time periods that is considered ON hours. It allows you to define what days are considered business days. Lastly it lets define from what email address the other system is sending requests.&lt;br /&gt;
&lt;br /&gt;
The parsing of current time is standard Perl. The important part is that $hour and $wday will have the current hour and day of the week. You need these to compare against your defined ON / OFF hours.&lt;br /&gt;
&lt;br /&gt;
The first IF block checks to see if it is from the external system. If it not then it exits out with a 0 and no page is sent.&lt;br /&gt;
&lt;br /&gt;
The second IF block checks to see if it during your business week. If it is not then it exits out with a 1 and a page is sent because it is OFF hours.&lt;br /&gt;
&lt;br /&gt;
The last IF block checks to see if it is during business hours. We already know that it&amp;#039;s within business days. If it is within business hours then it exits with a 0 and no page is sent.&lt;br /&gt;
&lt;br /&gt;
If it makes it to the last return statement you know it&amp;#039;s on a business day but off hours. So it exits out with a 1 and a page is sent.&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>