[rt-users] Help with setting RT Due Date

Alex Peters alex at peters.net
Wed Jul 16 10:57:44 EDT 2014


You can use something like:

$self->TicketObj->FirstCustomFieldValue('Need-By-Date')

to retrieve the value of the custom field.  Because the custom field is
free-form text and the date could be entered in any format, it is probably
wisest to run the field through an RT::Date object (to manage the free-form
parsing via Time::ParseDate) and then apply that to the ticket:

my $date = RT::Date->new($self->TransactionObj->CreatorObj);
$date->Set(
    Value => $self->TicketObj->FirstCustomFieldValue('Need-By-Date'),
    Format => 'unknown',
);
$self->TicketObj->SetDue($date->ISO);

This code is untested and doesn't take into account an unparseable date.  I
would guess that if the user enters an unparseable date, the Due date will
simply remain unset.

You mention "errors of various kinds" in your earlier post.  It could be
useful to see both those errors and the code triggering those errors.


On 17 July 2014 00:45, Alex Peters <alex at peters.net> wrote:

> ---------- Forwarded message ----------
> From: Joe Kirby <kirby at umbc.edu>
> Date: 16 July 2014 21:24
> Subject: Re: [rt-users] Help with setting RT Due Date
> To: Alex Peters <alex at peters.net>
>
>
> Thank you. I had forgotten that but in the end I still have the issue of
> trying to update the due date from a CF because I have a web form that
> captures this data and I need to populate the due date field
>
> Thank you for responding
>
> Joe
>
>  Joe Kirby ,  Assistant Vice President, Business Systems
> Division of Information Technology (DoIT)
> Support Response -   http://www.umbc.edu/doit
> Administration 627
> Office - 410-455-3020
> Email - kirby at umbc.edu
>
> On Jul 15, 2014, at 10:16 PM, Alex Peters <alex at peters.net> wrote:
>
> Entry of due date is possible at ticket creation by clicking the Details
> "tab" at the top right of the form.
> On 16/07/2014 6:50 am, "Joe Kirby" <kirby at umbc.edu> wrote:
>
>> I have a need to prompt the user for the desired need by date at ticket
>> creation. I did not see how to use the RT due date so I created a field
>> called Need-By-Date and set it up as Mandatory and Select Date.
>>
>> I need to set the RT Due Date to this value and I keep getting errors of
>> various kinds.
>>
>> I did look through the wiki and found AddDays, etc. functions but really
>> did not see anything that would achieve this.
>>
>> Can you help?
>>
>> Thanks
>>
>> Joe
>>
>>  Joe Kirby ,  Assistant Vice President, Business Systems
>> Division of Information Technology (DoIT)
>> Support Response -   http://www.umbc.edu/doit
>> Administration 627
>> Office - 410-455-3020
>> Email - kirby at umbc.edu
>>
>>
>> --
>> 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/20140717/b04f8313/attachment.htm>


More information about the rt-users mailing list