[rt-users] Add Time difference in search result

Alex Peters alex at peters.net
Wed Jul 30 20:27:50 EDT 2014


RT automatically stores dates and times into tickets when they are created,
opened and closed.

I notice that you want a relative value (e.g. "40 minutes ago"), which
means that that value is only meaningful for a very short time, so perhaps
you're wanting to place it in an outgoing email or something.

Can you tell us more about how you want to use this?  I suspect so far that
a custom field isn't necessary.
On 31/07/2014 1:29 am, "AJ" <aaron.mccarthy at southwestern.ie> wrote:

> Hi,
>
> I have made a "datetime" CustomField. Whenever a ticket is changed from
> open
> to resolve the date and time will be inserted into the custom field.
>
> However I want it to display the time elapsed e.g. 40 minutes ago etc.
>
> This is the code I am using in location
> /html/Callbacks/MyRT/Elements/RT__Ticket/ColumnMap
>
> <%init>
> $COLUMN_MAP->{DifferenceReopenedTime} =  {
>         title     => 'Reopened', # loc
>         attribute => 'Reopened',
>         value     => sub {
>            my $CFValue = $Ticket->FirstCustomFieldValue('13')
>            my $now = RT::Date->new($RT::SystemUser);
>            $now->SetToNow();
>
>
>            return $CFValue->AgeAsString();
>         }
> };
> </%init>
> <%args>
> $COLUMN_MAP
> </%args>
>
> Can anyone help
>
>
>
> --
> View this message in context:
> http://requesttracker.8502.n7.nabble.com/Add-Time-difference-in-search-result-tp58100.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/6a6e50bf/attachment.htm>


More information about the rt-users mailing list