Hi,
Is there a way to calculate Hours Worked (using Business Hours) based on the
difference betwee Resolved Time and Created Time and then move it to a
custom Field?
Regards,
Chaitanya
Hi,
Is there a way to calculate Hours Worked (using Business Hours) based on the
difference betwee Resolved Time and Created Time and then move it to a
custom Field?
Regards,
Chaitanya
Chaitanya Veludandi wrote:
Hi,
Is there a way to calculate Hours Worked (using Business Hours) based on
the difference betwee Resolved Time and Created Time and then move it to
a custom Field?
Posted to this list less than 24 hours ago:
But do you know if it is possible for RT (I
couldn’t find it when I searched Google) to automatically enter the time
worked based on the time elapsed between when the ticket was opened and when
it was updated? I guess(?) that if an issue remained unresolved and the
customer called back it would have to add time to said ticket on each
update? I will keep searching for this on my own, but figured it couldn’t
hurt to ask.I don’t see why not. I might be wrong about the best way to do it, but
it certainly seems you could add a custom scrip action to do it.Pseudocode:
“On Ticket->Update, Ticket->Worked = Ticket->Updated() - Ticket->Created()”
Although, you might need to convert the times into Unix time, then do
the sums and then convert back again.
Kind Regards,
Mike Peachey, IT
Tel: +44 (0) 114 281 2655
Fax: +44 (0) 114 281 2951
Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK
Confidential
I wrote a mod to the Business::Hours package that lets you subtract one
date from another. It’s on the wiki as part of something else I posted,
but since I don’t remember where I’ll post it below. It works just like
the add_seconds() method, but it subtracts instead. You can either append
it to the end of your program or (I think) put it into your RT config file.
########## start of code
{ package Business::Hours;
sub sub_seconds {
### This method is hacked version of add_seconds(), written by Gene
LeDuc
my $self = shift;
my $start = shift;
my $seconds = shift;
# the maximum time after which we stop searching for business hours
my $MAXTIME = (30 * 24 * 60 * 60); # 30 days
my $first;
my $period = (24 * 60 * 60);
my $begin = $start - $period;
my $hours = new Set::IntSpan;
while ($hours->empty or $self->between($hours->first, $start) <=
$seconds) {
if ($begin <= $start - $MAXTIME) {
return -1;
if ($begin <= $start - $MAXTIME) {
return -1;
}
$hours = $self->for_timespan(Start => $begin, End => $start);
$begin -= $period;
}
my @elements = reverse elements $hours;
$first = $elements[$seconds];
return $first;
}
1; #this line is important and will help the module return a true value
}
############## end of code
Regards,
Gene
At 10:37 PM 2/7/2008, Chaitanya Veludandi wrote:
Hi,
Is there a way to calculate Hours Worked (using Business Hours) based on
the difference betwee Resolved Time and Created Time and then move it to a
custom Field?Regards,
Chaitanya
Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.comDiscover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
Gene LeDuc, GSEC
Security Analyst
San Diego State University
Hello,
I am trying to work on this time worked issue myself and have been trying
the following:
Condition: On Transaction
Action: user defined
Template: Global template: Blank
Stage: TransactionCreate
Custom Condition:
Custom action preparation code:
1;
Custom action cleanup code:
$ticket_Worked = ($self->TicketObj->Updated - $self->TicketObj->Created);
if ($self->TicketObj->Type eq “Correspond” || $self->TicketObj->Type eq
“Comment”)
{
$self->TicketObj->SetTimeWorked ($ticket_Worked);
}
else {
return 0;
}
Can someone tell me if that looks even remotely correct? I know that Mike
has said that we might need to convert times to Unix time and then back
again, and I haven’t tried that yet, but I also have not even got to see any
kind of data go into that field. I was thinking that I might be able to put
whatever is returned into a comment or something as well to see if that
would work, so I changed the $self->TicketObj->SetTimeWorked to
$self->TicketObj->setContent, but I also had nothing returned that I could
see.
Not really sure where to go from there, hoping that someone has some insight
for me (or even a small clue)
Greg Evans
-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf
Of Mike Peachey
Sent: Friday, February 08, 2008 12:24 AM
To: Chaitanya Veludandi; rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Hours WorkedChaitanya Veludandi wrote:
Hi,
Is there a way to calculate Hours Worked (using Business
Hours) based on
the difference betwee Resolved Time and Created Time and
then move it to
a custom Field?Posted to this list less than 24 hours ago:
[snip]
There are 2 things involved here:
regards,
Chaitanya."
I have a similar issue, I want to update TimeWorked Field in Request Tracker based on the difference of CreatedDate and ResolvedDate. But I haven’t figured out how to do it. Can you help me out? I badly need help. Thanks.
Would this extension do the job for you? RT::Extension::ElapsedBusinessTime - Calculate the elapsed business time that tickets are open - metacpan.org
Looking good! Thanks for the share!