[rt-users] Help with setting RT Due Date

2014-07-17 Thread Joe Kirby
Alex

Thank you very much for the code snippet. It worked like a charm!!

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 - ki...@umbc.edu

 
 
 
 Message: 9
 Date: Thu, 17 Jul 2014 00:57:44 +1000
 From: Alex Peters a...@peters.net
 To: rt-users@lists.bestpractical.com
   rt-users@lists.bestpractical.com
 Subject: Re: [rt-users] Help with setting RT Due Date
 Message-ID:
   CAFdkmpscs5-5r=v+3utiowaz10wtdupb6rnwyjdhvt8uemm...@mail.gmail.com
 Content-Type: text/plain; charset=utf-8
 
 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 a...@peters.net wrote:
 
 -- Forwarded message --
 From: Joe Kirby ki...@umbc.edu
 Date: 16 July 2014 21:24
 Subject: Re: [rt-users] Help with setting RT Due Date
 To: Alex Peters a...@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 - ki...@umbc.edu
 
 On Jul 15, 2014, at 10:16 PM, Alex Peters a...@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 ki...@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 - ki...@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-0001.html
 
 
 
 Subject: Digest Footer
 
 -- 
 -- 
 RT Training London, March 19-20 and Dallas May 20-21
 http://bestpractical.com/training
 
 rt-users mailing list
 rt-users@lists.bestpractical.com
 http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
 
 --
 
 End of rt-users Digest, Vol 124, Issue 17
 *

-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training

Re: [rt-users] Help with setting RT Due Date

2014-07-16 Thread Alex Peters
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 a...@peters.net wrote:

 -- Forwarded message --
 From: Joe Kirby ki...@umbc.edu
 Date: 16 July 2014 21:24
 Subject: Re: [rt-users] Help with setting RT Due Date
 To: Alex Peters a...@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 - ki...@umbc.edu

 On Jul 15, 2014, at 10:16 PM, Alex Peters a...@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 ki...@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 - ki...@umbc.edu


 --
 RT Training - Boston, September 9-10
 http://bestpractical.com/training




-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training

[rt-users] Help with setting RT Due Date

2014-07-15 Thread Joe Kirby
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 - ki...@umbc.edu

-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training