[rt-users] Setting Due date and Subject off of another ticket

Jared Hanks jmhanks1373 at hotmail.com
Mon Nov 6 21:55:36 EST 2006


Hello,
 
I am trying to set the date, and subject, of a ticket off of another ticket.  When a ticket is created with the subject like "TemporaryAccess" another ticket is created and linked to the first ticket.  I would like to set the Due date in Ticket2, based upon the due date of Ticket1.
 
I have the following in my scrip....
 
Custom action preparation code:  return 1;
---------------------------------------------------------------------------------------------------------------------------------
Custom action cleanup code:
 
my $vari = $self->TicketObj->RequestorAddresses;my $UserObj = RT::User->new(RT::CurrentUser->new($RT::SystemUser));my ($id, $worked) = $UserObj->LoadOrCreateByEmail($vari);my $mygroup = $UserObj->OwnGroups;my $nextgroup = $mygroup->Next();my $count = $nextgroup->Name;my ($status, $msg) = $self->TicketObj->SetQueue($count);
if($self->TicketObj->Subject =~/TemporaryAccess/i){my $TicketObjItem = RT::Ticket->new(RT::CurrentUser->new($RT::SystemUser));my $TicketId = $TicketObjItem->Create(Queue => $count, Type => "Ticket", RefersTo => $self->TicketObj->Id);$TicketObjItem->SetSubject("Delete $self->TicketObj->Subject");
$TicketObjItem->AddCustomFieldValue( Field => '40', Value => "Access", RecordTransaction => 1 );unless( $status ) {$RT::Logger->warning( "Couldn't set Access as value for CF TicketType". $msg );return undef;}$TicketObjItem->AddCustomFieldValue( Field => '41', Value => "Separation", RecordTransaction => 1 );unless( $status ){$RT::Logger->warning( "Couldn't set Separation as value for CF AccessManagementType". $msg );return undef;}$TicketObjItem->SetDue(Format => "Date", Value => $self->TicketObj->Due);}
 
-------------------------------------------------------------------------------------------------------------
 
Ticket1 is sent in via email with Set-Due: so Ticket1's Due is pulled from the email.
 
It looks like the Due date is trying to be set, but doesn't actually set it.  Ticket1 says:
 




#   
Mon Nov 06 18:24:55 2006
RT_System - Due changed from Not set to Not set 

 






#   
Mon Nov 06 18:24:55 2006
RT_System - Due changed from Thu Nov 09 16:00:00 2006 to Not set
 
and Ticket2 says:
 
#   Mon Nov 06 18:24:54 2006 RT_System - Due changed from Not set to Not set   
 
So it looks like Due is getting set on Ticket2 before Due is set on Ticket1???  Anyone have any ideas?  Should I be doing this differently?
 
Also, the subject of Ticket2 ends up coming out like "Delete RT::Action::UserDefined=HASH(0xb57baa8)->TicketObj->Subject".  Any ideas on this either?
 
Any help is greatly appreciated.
 
Thanks,
Jared
 

_________________________________________________________________
Personalize your Live.com homepage with the news, weather, and photos you care about. Try it.
http://www.live.com/getstarted.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20061106/1263bd66/attachment.htm>


More information about the rt-users mailing list