<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://greggsmith.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Send_Notification_to_CI%27s_Attached_Contacts</id>
		<title>Send Notification to CI's Attached Contacts - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://greggsmith.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Send_Notification_to_CI%27s_Attached_Contacts"/>
		<link rel="alternate" type="text/html" href="http://greggsmith.net/wiki/index.php?title=Send_Notification_to_CI%27s_Attached_Contacts&amp;action=history"/>
		<updated>2026-04-17T14:13:03Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.1</generator>

	<entry>
		<id>http://greggsmith.net/wiki/index.php?title=Send_Notification_to_CI%27s_Attached_Contacts&amp;diff=3674&amp;oldid=prev</id>
		<title>Gityerfix: Notification to CI attached contact(s) moved to Send Notification to CI's Attached Contacts: Implemented standardize naming scheme</title>
		<link rel="alternate" type="text/html" href="http://greggsmith.net/wiki/index.php?title=Send_Notification_to_CI%27s_Attached_Contacts&amp;diff=3674&amp;oldid=prev"/>
				<updated>2009-02-02T14:49:26Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;a href=&quot;/wiki/index.php?title=Notification_to_CI_attached_contact(s)&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Notification to CI attached contact(s) (page does not exist)&quot;&gt;Notification to CI attached contact(s)&lt;/a&gt; moved to &lt;a href=&quot;/wiki/index.php?title=Send_Notification_to_CI%27s_Attached_Contacts&quot; title=&quot;Send Notification to CI's Attached Contacts&quot;&gt;Send Notification to CI&amp;#039;s Attached Contacts&lt;/a&gt;: Implemented standardize naming scheme&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 14:49, 2 February 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;' lang='en'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Gityerfix</name></author>	</entry>

	<entry>
		<id>http://greggsmith.net/wiki/index.php?title=Send_Notification_to_CI%27s_Attached_Contacts&amp;diff=3671&amp;oldid=prev</id>
		<title>Gabu: New page: __NOTOC__ Category:Customizations Category:r6 Category:r11 Category:Schema Changes {{Global Header}} {{Global Announcement}}  == Overview == This article provides instructi...</title>
		<link rel="alternate" type="text/html" href="http://greggsmith.net/wiki/index.php?title=Send_Notification_to_CI%27s_Attached_Contacts&amp;diff=3671&amp;oldid=prev"/>
				<updated>2009-01-29T20:04:13Z</updated>
		
		<summary type="html">&lt;p&gt;New page: __NOTOC__ &lt;a href=&quot;/wiki/index.php?title=Category:Customizations&quot; title=&quot;Category:Customizations&quot;&gt;Category:Customizations&lt;/a&gt; &lt;a href=&quot;/wiki/index.php?title=Category:R6&quot; title=&quot;Category:R6&quot;&gt;Category:r6&lt;/a&gt; &lt;a href=&quot;/wiki/index.php?title=Category:R11&quot; title=&quot;Category:R11&quot;&gt;Category:r11&lt;/a&gt; &lt;a href=&quot;/wiki/index.php?title=Category:Schema_Changes&quot; title=&quot;Category:Schema Changes&quot;&gt;Category:Schema Changes&lt;/a&gt; {{Global Header}} {{Global Announcement}}  == Overview == This article provides instructi...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
[[Category:Customizations]]&lt;br /&gt;
[[Category:r6]]&lt;br /&gt;
[[Category:r11]]&lt;br /&gt;
[[Category:Schema Changes]]&lt;br /&gt;
{{Global Header}}&lt;br /&gt;
{{Global Announcement}}&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
This article provides instructions for having a notification to CI attached contact(s). Because severals CI can be attached on a changed, there is no native solution to send notification to all contacts attached to all CI attached to a change.&lt;br /&gt;
&lt;br /&gt;
== Procedures ==&lt;br /&gt;
=== Step 1. Create the script ===&lt;br /&gt;
{{Create Spell Script}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
chg::znotif_ci_cnt(...)&lt;br /&gt;
{&lt;br /&gt;
object nr_dob, nr_list, group_leader;&lt;br /&gt;
int nr_count, i;&lt;br /&gt;
string persid,chg_ref_num, wc, nr_retour,nr_id;&lt;br /&gt;
persid = argv[3];&lt;br /&gt;
chg_ref_num = argv[6];&lt;br /&gt;
object cnt_dob, cnt_list;&lt;br /&gt;
int cnt_count, j;&lt;br /&gt;
string wc2,cnt_retour,cnt_id;&lt;br /&gt;
string evt_mtitle, evt_mbody;&lt;br /&gt;
evt_mtitle = format(&amp;quot;CO '%s'&amp;quot;, chg_ref_num);&lt;br /&gt;
evt_mbody = format(&amp;quot;CO'%s'&amp;quot;, chg_ref_num);&lt;br /&gt;
evt_mbody += format(&amp;quot;blabla\n&amp;quot;);&lt;br /&gt;
evt_mbody += format(&amp;quot;blabla&amp;quot;);&lt;br /&gt;
int evt_level;&lt;br /&gt;
evt_level = 2;&lt;br /&gt;
int trans_pt;&lt;br /&gt;
trans_pt = 28;&lt;br /&gt;
&lt;br /&gt;
//check if there is CI attached to the change&lt;br /&gt;
wc = format(&amp;quot;lpid = '%s' AND lattr = 'asset'&amp;quot;, persid);&lt;br /&gt;
send_wait(0, top_object(), &amp;quot;call_attr&amp;quot;, &amp;quot;lrel1&amp;quot;, &amp;quot;sync_fetch&amp;quot;, &amp;quot;STATIC&amp;quot;, wc, -1, 0);&lt;br /&gt;
nr_list = msg[0];&lt;br /&gt;
nr_count = msg[1];&lt;br /&gt;
&lt;br /&gt;
//For each CI we get the persid&lt;br /&gt;
if (nr_count &amp;gt; 0) {&lt;br /&gt;
for (i=0;i&amp;lt;nr_count;i++) {&lt;br /&gt;
&lt;br /&gt;
send_wait(0, nr_list, &amp;quot;dob_by_index&amp;quot;, &amp;quot;DEFAULT&amp;quot;, i, i);&lt;br /&gt;
nr_dob = msg[0];&lt;br /&gt;
send_wait (0, nr_dob, &amp;quot;get_attr_vals&amp;quot;, 1, &amp;quot;rpid&amp;quot;);&lt;br /&gt;
//CI UUID&lt;br /&gt;
nr_retour = msg[3];&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//for each CI we check if there is contact&lt;br /&gt;
wc2 = format(&amp;quot;rpid = '%s' AND rattr = 'cntref'&amp;quot;, nr_retour);&lt;br /&gt;
send_wait(0, top_object(), &amp;quot;call_attr&amp;quot;, &amp;quot;lrel1&amp;quot;, &amp;quot;sync_fetch&amp;quot;, &amp;quot;STATIC&amp;quot;, wc2, -1, 0);&lt;br /&gt;
cnt_list = msg[0];&lt;br /&gt;
cnt_count = msg[1];&lt;br /&gt;
&lt;br /&gt;
//if there is contact, send an email&lt;br /&gt;
if (cnt_count &amp;gt; 0) {&lt;br /&gt;
for (j=0;j&amp;lt;cnt_count;j++) {&lt;br /&gt;
send_wait(0, cnt_list, &amp;quot;dob_by_index&amp;quot;, &amp;quot;DEFAULT&amp;quot;, j, j);&lt;br /&gt;
cnt_dob = msg[0];&lt;br /&gt;
send_wait (0, cnt_dob, &amp;quot;get_attr_vals&amp;quot;, 1, &amp;quot;lpid&amp;quot;);&lt;br /&gt;
cnt_retour = msg[3];&lt;br /&gt;
cnt_id = substr(cnt_retour,sindex(cnt_retour,&amp;quot;:&amp;quot;)+1);&lt;br /&gt;
&lt;br /&gt;
send(top_object(), &amp;quot;call_attr&amp;quot;, &amp;quot;cnt&amp;quot;, &amp;quot;notify_list&amp;quot;,&lt;br /&gt;
cnt_retour, evt_level, evt_mtitle, evt_mbody, &amp;quot;&amp;quot;, trans_pt, persid, 0, 0);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The trigger that will be created in step 2 is the first level filtering. If you need further filtering then utilize an if statement in the [[spel code]] above.&lt;br /&gt;
&lt;br /&gt;
=== Step 2. Create the trigger ===&lt;br /&gt;
This step is to create the trigger that will initiate the script. The methods used to implement the trigger vary based on the Service Desk release.  In the examples to follow, the trigger is designed to fire if the Status is being changed to 'Resolved'. Use whatever filter you like for attaching your [[Events and Macros|Event]].&lt;br /&gt;
&lt;br /&gt;
''For r11.x releases'' triggers are created via the [[Schema Designer]] utility. Simply add the following code as a [[Site-Defined Trigger]] to the '''[[Change Request Table|chg (Change Order)]]''' table.&lt;br /&gt;
 POST_VALIDATE znotif_ci_cnt() 111 FILTER(EVENT(&amp;quot;INSERT&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
''For older releases'' triggers are made by creating a [[.mod file]] and placing it in the [[$NX_ROOT]]/site/mods/majic directory. Name the [[.mod file|.mod]] anything you like, but it is recommended that it be preceded with a 'z'.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
OBJECT chg {&lt;br /&gt;
  TRIGGERS {&lt;br /&gt;
    POST_VALIDATE znotif_ci_cnt() 111 FILTER(EVENT(&amp;quot;INSERT&amp;quot;));&lt;br /&gt;
  };&lt;br /&gt;
};&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 3. Publish the Schema changes ===&lt;br /&gt;
{{Publish Schema Change}}&lt;/div&gt;</summary>
		<author><name>Gabu</name></author>	</entry>

	</feed>