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:
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
Try the next generation of search with Windows LiveT Search today! Try it!
_______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
