Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

2011-03-17 Thread Ruslan Zakirov
Not tested, but very close. Should work with 3.8.9 and may be a few
versions older.

file: local/html/Callbacks/MandatoryFields/Ticket/Update.html/BeforeUpdate
content:

%ARGS
$TicketObj
$ARGSRef = {}
$skip_update = undef
$results = []
/%ARGS
%INIT
my $value = $ARGSRef-{'UpdateTimeWorked'};
return if defined $value  length $value;

$$skip_update = 1;
push @$results, loc(You have to define time worked);
/%INIT


On Tue, Mar 15, 2011 at 3:46 PM, Pena, Christian
christian.p...@corp.earthlink.com wrote:
 This is something that has probably been asked on the lists many time so
 bear with me.



 I want to make the “Worked” field mandatory on every ticket update. I read
 references on the need to do Call Backs but not sure what Syntax to use to
 achieve this. Can anyone point me in the right direction?



 Thanks!



 Christian Pena
 Network Engineer Supervisor
 EarthLink Business

 E: christian.p...@corp.earthlink.com
 O: 786-363-0460 | F: 786-363-0206
 STS Telecom is now EarthLink Business





-- 
Best regards, Ruslan.


Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

2011-03-17 Thread Michael Coakley
Christian,

While I hope that Ruslan's solution works for you - and it may be one that I 
implement myself. I've approached this problem differently in the past. 
Generally, I've viewed this issue as a management issue. As such I've developed 
external reports from RT that tell me how much time individuals have worked on 
specific queues. The SQL query I use to build these reports gives me a detailed 
report that I then use Excel PivotTables to provide the summaries I need.

Here is the SQL:

SELECT t.id, t.Subject, tr.TimeTaken, tr.Created, u.Realname
FROM (Tickets AS t INNER JOIN Transactions AS tr ON t.id = tr.ObjectId) INNER 
JOIN
  Users AS u ON tr.Creator = u.id
WHERE t.EffectiveId = t.id AND
  t.Status = 'resolved' AND
  t.Resolved = '2010-03-01%' AND
  (t.Status NOT LIKE '%Event%' OR t.Status NOT LIKE 'Log File%') AND
  tr.ObjectType = 'RT::Ticket' AND
  (tr.Type = 'Comment' OR tr.Type = 'Correspond') AND
  tr.TimeTaken  0
ORDER BY u.RealName, t.id, tr.Created;

While some of this SQL is specific to my situation (i.e. the entire   
(t.Status NOT LIKE '%Event%' OR t.Status NOT LIKE 'Log File%') AND line can be 
removed), the command provides all the information you will need to provide 
very detailed reports on Time Worked across Tickets. (NOTE in the SQL I also 
ONLY look for transactions with Time (i.e. tr.TimeTaken  0) you can easily 
remove that line or change it to tr.TimeTaken = 0 to include Transactions in 
which there is no time entered.

Anyway... I use this report to keep my technicians in line by showing them the 
difference of how much work time they logged compared to actual time worked. 
Also, this type of analytical data is very useful during reviews, such as if a 
person is only accounting for 50-60% of their time, then they aren't following 
company policy very well.

I'm sure you get the idea... and if you are looking for simple enforcement 
Ruslan's method looks pretty clean - as always!

Thanks,

Mike

On Mar 15, 2011, at 8:46 AM, Pena, Christian wrote:

 This is something that has probably been asked on the lists many time so bear 
 with me.
  
 I want to make the “Worked” field mandatory on every ticket update. I read 
 references on the need to do Call Backs but not sure what Syntax to use to 
 achieve this. Can anyone point me in the right direction?
  
 Thanks!
  
 Christian Pena
 Network Engineer Supervisor
 EarthLink Business 
   
 E: christian.p...@corp.earthlink.com
 O: 786-363-0460 | F: 786-363-0206
 STS Telecom is now EarthLink Business
  



Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

2011-03-15 Thread Emmanuel Lacour
On Tue, Mar 15, 2011 at 07:46:09AM -0500, Pena, Christian wrote:
This is something that has probably been asked on the lists many time so
bear with me.
 

http://www.mail-archive.com/rt-users@lists.bestpractical.com/msg28060.html


;)


Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

2011-03-15 Thread Kenneth Crocker
Christian,

I couldn't find an easy way to do this without a lot of mods to the RT code
(which I'm REAL BAD at as a beginner in perl), so I wrote a scrip
work-around. If someone tries to resolve a ticket without any TimeWorked,
I re-set the status to Stalled and send them an email telling them what I
did and why. I also set a CF to a value I use for the email notification.
Let me know if that's the way you want to go.

Kenn
LBNL

On Tue, Mar 15, 2011 at 5:46 AM, Pena, Christian 
christian.p...@corp.earthlink.com wrote:

 This is something that has probably been asked on the lists many time so
 bear with me.



 I want to make the “Worked” field mandatory on every ticket update. I read
 references on the need to do Call Backs but not sure what Syntax to use to
 achieve this. Can anyone point me in the right direction?



 Thanks!



 *Christian Pena*
 Network Engineer Supervisor
 *EarthLink Business*

 *E: *christian.p...@corp.earthlink.com
 *O:* 786-363-0460 | *F:* 786-363-0206
 *STS Telecom is now EarthLink Business*





Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

2011-03-15 Thread Pena, Christian
We use RT for supporting customers and often times there are multiple
phone calls on a single RT case. So simply forcing time Worked on
Resolution is not what I am looking for. 


I am trying to track how long each person is taking supporting different
things. I have tried to mandate people to update the Worked field on
every update, but I think I need a to whip them harder or code a better
solution J

 

Christian Pena
Network Engineer Supervisor
EarthLink Business 
  
E: christian.p...@corp.earthlink.com
O: 786-363-0460 | F: 786-363-0206
STS Telecom is now EarthLink Business

 

From: rt-users-boun...@lists.bestpractical.com
[mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth
Crocker
Sent: Tuesday, March 15, 2011 12:04 PM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

 

Christian,

I couldn't find an easy way to do this without a lot of mods to the RT
code (which I'm REAL BAD at as a beginner in perl), so I wrote a scrip
work-around. If someone tries to resolve a ticket without any
TimeWorked, I re-set the status to Stalled and send them an email
telling them what I did and why. I also set a CF to a value I use for
the email notification. Let me know if that's the way you want to go.

Kenn
LBNL

On Tue, Mar 15, 2011 at 5:46 AM, Pena, Christian
christian.p...@corp.earthlink.com wrote:

This is something that has probably been asked on the lists many time so
bear with me. 

 

I want to make the Worked field mandatory on every ticket update. I
read references on the need to do Call Backs but not sure what Syntax to
use to achieve this. Can anyone point me in the right direction? 

 

Thanks!

 

Christian Pena
Network Engineer Supervisor
EarthLink Business 
  
E: christian.p...@corp.earthlink.com
O: 786-363-0460 | F: 786-363-0206
STS Telecom is now EarthLink Business

 

 



Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

2011-03-15 Thread Kenneth Crocker
Christian,

The option I offered you can certainly be modified for a different condition
(like On Transaction, or if the value of some other field is modified,
etc.). You just have to decide what condition (simple or complex) you want.
I'll help you if you want.

Kenn
LBNL

On Tue, Mar 15, 2011 at 9:27 AM, Pena, Christian 
christian.p...@corp.earthlink.com wrote:

 We use RT for supporting customers and often times there are multiple phone
 calls on a single RT case. So simply forcing time Worked on Resolution is
 not what I am looking for.


 I am trying to track how long each person is taking supporting different
 things. I have tried to mandate people to update the Worked field on every
 update, but I think I need a to whip them harder or code a better solution
 J



 *Christian Pena*
 Network Engineer Supervisor
 *EarthLink Business*

 *E: *christian.p...@corp.earthlink.com
 *O:* 786-363-0460 | *F:* 786-363-0206
 *STS Telecom is now EarthLink Business*



 *From:* rt-users-boun...@lists.bestpractical.com [mailto:
 rt-users-boun...@lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
 *Sent:* Tuesday, March 15, 2011 12:04 PM
 *To:* rt-users@lists.bestpractical.com
 *Subject:* Re: [rt-users] Mandatory Time Worked Field on Ticket Updates



 Christian,

 I couldn't find an easy way to do this without a lot of mods to the RT code
 (which I'm REAL BAD at as a beginner in perl), so I wrote a scrip
 work-around. If someone tries to resolve a ticket without any TimeWorked,
 I re-set the status to Stalled and send them an email telling them what I
 did and why. I also set a CF to a value I use for the email notification.
 Let me know if that's the way you want to go.

 Kenn
 LBNL

 On Tue, Mar 15, 2011 at 5:46 AM, Pena, Christian 
 christian.p...@corp.earthlink.com wrote:

 This is something that has probably been asked on the lists many time so
 bear with me.



 I want to make the “Worked” field mandatory on every ticket update. I read
 references on the need to do Call Backs but not sure what Syntax to use to
 achieve this. Can anyone point me in the right direction?



 Thanks!



 *Christian Pena*
 Network Engineer Supervisor
 *EarthLink Business*

 *E: *christian.p...@corp.earthlink.com
 *O:* 786-363-0460786-363-0460 | *F:* 786-363-0206786-363-0206
 *STS Telecom is now EarthLink Business*







Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

2011-03-15 Thread Pena, Christian
Then that would be great. Can you send me an example of your scrip?

 

Christian Pena
Network Engineer Supervisor
EarthLink Business 
  
E: christian.p...@corp.earthlink.com
O: 786-363-0460 | F: 786-363-0206
STS Telecom is now EarthLink Business

 

From: rt-users-boun...@lists.bestpractical.com
[mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth
Crocker
Sent: Tuesday, March 15, 2011 12:31 PM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

 

Christian,

The option I offered you can certainly be modified for a different
condition (like On Transaction, or if the value of some other field is
modified, etc.). You just have to decide what condition (simple or
complex) you want. I'll help you if you want.

Kenn
LBNL

On Tue, Mar 15, 2011 at 9:27 AM, Pena, Christian
christian.p...@corp.earthlink.com wrote:

We use RT for supporting customers and often times there are multiple
phone calls on a single RT case. So simply forcing time Worked on
Resolution is not what I am looking for. 


I am trying to track how long each person is taking supporting different
things. I have tried to mandate people to update the Worked field on
every update, but I think I need a to whip them harder or code a better
solution J

 

Christian Pena
Network Engineer Supervisor
EarthLink Business 
  
E: christian.p...@corp.earthlink.com
O: 786-363-0460 | F: 786-363-0206
STS Telecom is now EarthLink Business

 

From: rt-users-boun...@lists.bestpractical.com
[mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth
Crocker
Sent: Tuesday, March 15, 2011 12:04 PM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

 

Christian,

I couldn't find an easy way to do this without a lot of mods to the RT
code (which I'm REAL BAD at as a beginner in perl), so I wrote a scrip
work-around. If someone tries to resolve a ticket without any
TimeWorked, I re-set the status to Stalled and send them an email
telling them what I did and why. I also set a CF to a value I use for
the email notification. Let me know if that's the way you want to go.

Kenn
LBNL

On Tue, Mar 15, 2011 at 5:46 AM, Pena, Christian
christian.p...@corp.earthlink.com wrote:

This is something that has probably been asked on the lists many time so
bear with me. 

 

I want to make the Worked field mandatory on every ticket update. I
read references on the need to do Call Backs but not sure what Syntax to
use to achieve this. Can anyone point me in the right direction? 

 

Thanks!

 

Christian Pena
Network Engineer Supervisor
EarthLink Business 
  
E: christian.p...@corp.earthlink.com
O: 786-363-0460 | F: 786-363-0206
STS Telecom is now EarthLink Business

 

 

 



Re: [rt-users] Mandatory Time Worked Field on Ticket Updates

2011-03-15 Thread Kenneth Crocker
Christian,

Sure. The first one checks for TimeWorked when the ticket is resolved. If no
TImeWorked, it sets the status to Stalled and sets a CF Value in order to
trigger an email notification:

Scrip1 - Check for TimeWorked:
Condition: On Resolve
Action: user-Defined
Template: Global template: Blank
Stage: TransactionBatch

Custom Action Prep Code:
# Set initial values

my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
my $cf_obj = new RT::CustomField($RT::SystemUser);
my $timeworked = $ticket-TimeWorked;

# Set value for CF Work-State if TimeWorked not set

my $cf_name = Work-State;
my $cf_value = TIME WORKED NOT SET;

unless ($timeworked)
{
 $cf_obj-LoadByName(Name=$cf_name);
 $RT::Logger-debug(Loaded\$cf_obj-Name = . $cf_obj-Name() .\n );
 $ticket-AddCustomFieldValue( Field=$cf_obj, Value=$cf_value,
RecordTransaction=0 );
 $ticket-SetStatus(stalled);
}
return 1;

Custom Action Cleanup Code:
return 1;

Of course, you might want to change the condition to User-Defined and code
up your trigger.
Then, there is the Email notification that the ticket owner didn't set
TimeWorked in his ticket:
I had to add a new type of Action called AutoReply to Owner so I could use
it.

Scrip 2 - Notify Owner on No Time
Condition: User-Defined
Action: AutoReply to Owner
Template: Global template: Owner Time not Set
Stage: TransactionBatch

Custom Condition Code:

# Set initial values

my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
my $state = $ticket-FirstCustomFieldValue('Work-State');

# Check for trans status of stalled and the CF Work-State
# for TIME WORKED NOT SET

return ($trans-Type eq Status 
  $trans-NewValue eq stalled 
  $state eq TIME WORKED NOT SET);

That's it. The reason I had to add the new AutoReply to Owner is because I
have my configuration set for NotifyActor, 0. So, the owner is the actor
and he wouldn't get an email when he did that transaction. I believe the RT
Essentials has instructions on this, but if you get confused, let me know
and I'll send you step by step instructions.

Lot's of luck.

Kenn
LBNL

On Tue, Mar 15, 2011 at 9:37 AM, Pena, Christian 
christian.p...@corp.earthlink.com wrote:

 Then that would be great. Can you send me an example of your scrip?



 *Christian Pena*
 Network Engineer Supervisor
 *EarthLink Business*

 *E: *christian.p...@corp.earthlink.com
 *O:* 786-363-0460 | *F:* 786-363-0206
 *STS Telecom is now EarthLink Business*



 *From:* rt-users-boun...@lists.bestpractical.com [mailto:
 rt-users-boun...@lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
 *Sent:* Tuesday, March 15, 2011 12:31 PM

 *To:* rt-users@lists.bestpractical.com
 *Subject:* Re: [rt-users] Mandatory Time Worked Field on Ticket Updates



 Christian,

 The option I offered you can certainly be modified for a different
 condition (like On Transaction, or if the value of some other field is
 modified, etc.). You just have to decide what condition (simple or complex)
 you want. I'll help you if you want.

 Kenn
 LBNL

 On Tue, Mar 15, 2011 at 9:27 AM, Pena, Christian 
 christian.p...@corp.earthlink.com wrote:

 We use RT for supporting customers and often times there are multiple phone
 calls on a single RT case. So simply forcing time Worked on Resolution is
 not what I am looking for.


 I am trying to track how long each person is taking supporting different
 things. I have tried to mandate people to update the Worked field on every
 update, but I think I need a to whip them harder or code a better solution
 J



 *Christian Pena*
 Network Engineer Supervisor
 *EarthLink Business*

 *E: *christian.p...@corp.earthlink.com
 *O:* 786-363-0460786-363-0460 | *F:* 786-363-0206786-363-0206
 *STS Telecom is now EarthLink Business*



 *From:* rt-users-boun...@lists.bestpractical.com [mailto:
 rt-users-boun...@lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
 *Sent:* Tuesday, March 15, 2011 12:04 PM
 *To:* rt-users@lists.bestpractical.com
 *Subject:* Re: [rt-users] Mandatory Time Worked Field on Ticket Updates



 Christian,

 I couldn't find an easy way to do this without a lot of mods to the RT code
 (which I'm REAL BAD at as a beginner in perl), so I wrote a scrip
 work-around. If someone tries to resolve a ticket without any TimeWorked,
 I re-set the status to Stalled and send them an email telling them what I
 did and why. I also set a CF to a value I use for the email notification.
 Let me know if that's the way you want to go.

 Kenn
 LBNL

 On Tue, Mar 15, 2011 at 5:46 AM, Pena, Christian 
 christian.p...@corp.earthlink.com wrote:

 This is something that has probably been asked on the lists many time so
 bear with me.



 I want to make the “Worked” field mandatory on every ticket update. I read
 references on the need to do Call Backs but not sure what Syntax to use to
 achieve this. Can anyone point me in the right direction?



 Thanks!



 *Christian Pena*
 Network Engineer Supervisor
 *EarthLink Business*

 *E