<div>Hi,</div><div><br></div><div>Before I start with the actual question I'll explain what I'm trying to achieve first, just in case someone has a better idea for achieving it ;)</div><div><br></div><div>As you know the SLA plugin does it's job quite well but what if you'd want to know exactly how long something was at a supplier or how long a customer left you waiting for your reports?</div>
<div>It's quite difficult to find this information, and in our case we use Business Objects to datamine RT's database and it's quite complicated within BO to calculate these values (and taking into account the actual SLA service windows + holidays).</div>
<div><br></div><div>Because of that we decided that we needed to solve this within RT, but how?</div><div><br></div><div>Below a list of our status types:</div><div><ul><li>New</li><li>Open</li><li>Parked</li><li>At_supplier</li>
<li>At_requestor</li><li>At_Internal_department</li></ul><div>(roughly translated since we use Dutch names for this)</div></div><div><br></div><div><div>Our solution was to create a Custom Field for every active/initial ticket status type, this CF would have the soul purpose of simply showing the amount of minutes a ticket had this status.</div>
</div><div>Thus the names of these CF's would look something like this: (these fields will be hidden from users)</div><div><ul><li>Time_New</li><li>Time_Open</li><li>Time_Parked</li><li>Time_At_supplier</li><li>Time_At_requestor</li>
<li>Time_At_Internal_department</li></ul></div><div>Just to keep things clear I'm leaving these names as they are, this part up to now is rather simple. The difficult part is to get a value inside those fields.</div><div>
<br></div><div>We thought it would be good to create a cron job which will execute a bash script (or perl, though I'm more familiar with bash) which will use rt-crontool to search for all tickets with status X and then increase the value of the CF Time_X by 5.</div>
<div>The cron job would run every 5 minutes, only during our service window and within the bash script we'll add the intelligence for skipping the holidays.</div><div><br></div><div>So far so good.</div><div><br></div>
<div>I've then created a simple rt-crontool command to see if I could find a ticket and if I could set a value when I found that ticket. This worked as well, below the result:</div><div><br></div><div><div><font class="Apple-style-span" face="'courier new', monospace">/opt/rt4/bin/rt-crontool \</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">     </span>--search RT::Search::FromSQL \</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre"> </span>--search-arg "status = 'open'" \</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-tab-span" style="white-space:pre">     </span>--action RT::Action::SetPriority --action-arg 3 \</font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-tab-span" style="white-space: pre; ">   </span>--verbose</font></div>
</div><div><br></div><div>So now for the question(s):</div><div><ul><li>First a simple one, how do I set a value for a custom field?</li><li>And the more difficult one, how do I increase a value instead of replacing it? (adding + or something like that doesn't seem to work)</li>
</ul><div>Hopefully this is possible with the rt-crontool, if not then I'd like to hear your thoughts on how I'd be able to do the above in a different manner.</div></div><div><br></div><div>Thanks in advance for replying :-)</div>
<br clear="all">-- Bart<br>