[rt-users] Add Time difference in search result

Alex Peters alex at peters.net
Thu Jul 31 03:30:22 EDT 2014


Okay, I understand now: you want to track when a ticket moves from resolved
to open (which isn't recorded automatically), not open to resolved (which
is).

   - You need to obtain access to the ticket here via shift, not $Ticket.
   - One line is missing a terminating semicolon.
   - You can use names when loading custom field values (I'm guessing 13 is
   the ID), but ID works too.
   - The date object needs to be loaded with the time of the field, not the
   current time.
   - The AgeAsString method is provided by the RT::Date object, not the
   ticket.

This code is untested but should be closer to what you want, although it
may need to be tweaked depending on the format in which you write the
custom field value beforehand:

...
value => sub {
  my $ticket = shift;
  my $reopened = $ticket->FirstCustomFieldValue(13);
  my $date = RT::Date->new($RT::SystemUser);
  $date->Set( Format => 'ISO', Value => $reopened );
  return $date->AgeAsString;
}
...


On 31 July 2014 16:53, AJ <aaron.mccarthy at southwestern.ie> wrote:

> I'm just using the custom field at the moment to store the date and time of
> which a ticket was re opened. I was using this custom field value in the
> file I mentioned in the first message along with code I'm using also. I'm
> starting to suspect I do not need a custom field. See image of what I have
> so far. Is there another way about using this?
>
> <http://requesttracker.8502.n7.nabble.com/file/n58112/untitled.bmp>
>
>
>
> --
> View this message in context:
> http://requesttracker.8502.n7.nabble.com/Add-Time-difference-in-search-result-tp58100p58112.html
> Sent from the Request Tracker - User mailing list archive at Nabble.com.
> --
> RT Training - Boston, September 9-10
> http://bestpractical.com/training
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140731/ccb9bf8e/attachment.htm>


More information about the rt-users mailing list