<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://greggsmith.net/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gabu</id>
		<title>SDU - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://greggsmith.net/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gabu"/>
		<link rel="alternate" type="text/html" href="http://greggsmith.net/wiki/index.php?title=Special:Contributions/Gabu"/>
		<updated>2026-07-27T14:25:02Z</updated>
		<subtitle>User contributions</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=3671</id>
		<title>Send Notification to CI's Attached Contacts</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"/>
				<updated>2009-01-29T20:04:13Z</updated>
		
		<summary type="html">&lt;p&gt;Gabu: New page: __NOTOC__ Category:Customizations Category:r6 Category:r11 Category:Schema Changes {{Global Header}} {{Global Announcement}}  == Overview == This article provides instructi...&lt;/p&gt;
&lt;hr /&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>

	<entry>
		<id>http://greggsmith.net/wiki/index.php?title=Workshift_work2abs&amp;diff=3464</id>
		<title>Workshift work2abs</title>
		<link rel="alternate" type="text/html" href="http://greggsmith.net/wiki/index.php?title=Workshift_work2abs&amp;diff=3464"/>
				<updated>2008-11-05T17:01:50Z</updated>
		
		<summary type="html">&lt;p&gt;Gabu: error in function definition&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Global Header}}&lt;br /&gt;
{{Global Announcement}}&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
USD utilizes workshifts and sometimes it is useful to be able to determine times within a workshift. &lt;br /&gt;
&lt;br /&gt;
date workshift_work2abs(string workshift, date start, int duration) &lt;br /&gt;
&lt;br /&gt;
Returns the date from the start date plus the duration for the given workshift. Note: workshift is represented as a string (eg. &amp;quot;Mon - Fri { 7:30 am - 5:30 pm }&amp;quot;)&lt;/div&gt;</summary>
		<author><name>Gabu</name></author>	</entry>

	</feed>