<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>I figured out how to set the Subject. I changed:<BR>
<BR>
my $TicketId = $TicketObjItem->Create(Queue => $count, Type => "Ticket", RefersTo => $self->TicketObj->Id);<BR>$TicketObjItem->SetSubject("Delete $self->TicketObj->Subject");<BR>
<BR>
to:<BR>
<BR>
my $subject = $self->TicketObj->Subject;<BR>
my $TicketId = $TicketObjItem->Create(Queue => $count, Type => "Ticket", Subject => "Delete $subject", RefersTo => $self->TicketObj->Id);<BR>
<BR>
I'm still unable to set the Due date. I did remember that I have a scrip that also runs when a new ticket gets created. It is:<BR>
<BR>
Custom action preparation code:<BR>
<BR>
return 1;<BR>
<BR>
--------------------------------------<BR>
<BR>
Custom action clean up code:<BR>
<BR>
1;<BR>
my $AttachObj = $self->TransactionObj->Attachments->First;<BR># go out if content is not text!<BR>unless( $AttachObj->ContentType =~ /^text/ )<BR>{<BR>return 1;<BR>}<BR>
my $content = $AttachObj->Content;<BR>if($self->TicketObj->Subject =~/TemporaryAccess/i)<BR>{<BR>my $tickID = $self->TicketObj->Id+1;<BR>$tickID->TicketObj->SetDue(Format=>"ISO", Value=>$1);<BR>}<BR>if( $content =~ m/^\QSet-Starts:\E\s*(\S+)\s*$/m )<BR>{<BR>$self->TicketObj->SetStarts( $1 );<BR>}<BR>if( $content =~ m/^\QSet-Due:\E\s*(\S+)\s*$/m )<BR>{<BR>$self->TicketObj->SetDue(Format=>"ISO", Value=>$1);<BR>}<BR>if( $content =~ m/^\QSet-Owner:\E\s*(\S+)\s*$/m )<BR>{<BR>$self->TicketObj->SetOwner( $1 );<BR>}<BR>if( $content =~ m/^\QSet-Status:\E\s*(\S+)\s*$/m )<BR>{<BR>$self->TicketObj->SetStatus( $1 );<BR>}<BR>if( $content =~ m/^\QSet-Time-Worked:\E\s*(\S+)\s*$/m )<BR>{<BR>$self->TicketObj->SetTimeWorked( $1);<BR>}<BR>
# strip special commands from email content<BR>#$content =~ s/^\QSet-Starts:\E\s*(\S+)\s*$//gm;<BR>#$content =~ s/^\QSet-Due:\E\s*(\S+)\s*$//gm;<BR>$content =~ s/^\QSet-Status:\E\s*(\S+)\s*$//gm;<BR>$content =~ s/^\QSet-Owner:\E\s*(\S+)\s*$//gm;<BR>$content =~ s/^\QSet-Time-Worked:\E\s*(\S+)\s*$//gm;<BR>
# silently overwrite attachment content<BR>$AttachObj->__Set( Field => 'Content', Value => $content );<BR>
1;<BR><BR>
-----------------------------------------------------------------------------------------<BR>
<BR>
Any help is greatly appreciated.<BR>
<BR>
Thanks,<BR>
Jared<BR><BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #008080 2px solid; MARGIN-RIGHT: 0px">
<HR id=EC_stopSpelling>
<BR>
From: jmhanks1373@hotmail.com<BR>To: rt-users@lists.bestpractical.com<BR>Date: Mon, 6 Nov 2006 18:55:36 -0800<BR>Subject: [rt-users] Setting Due date and Subject off of another ticket<BR><BR>
<META content="Microsoft SafeHTML" name=Generator>
<STYLE>
.ExternalClass P
{padding:0px;}
.ExternalClass
{font-size:10pt;font-family:Tahoma;}
</STYLE>
Hello,<BR> <BR>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.<BR> <BR>I have the following in my scrip....<BR> <BR>Custom action preparation code: return 1;<BR>---------------------------------------------------------------------------------------------------------------------------------<BR>Custom action cleanup code:<BR> <BR>my $vari = $self->TicketObj->RequestorAddresses;<BR>my $UserObj = RT::User->new(RT::CurrentUser->new($RT::SystemUser));<BR>my ($id, $worked) = $UserObj->LoadOrCreateByEmail($vari);<BR>my $mygroup = $UserObj->OwnGroups;<BR>my $nextgroup = $mygroup->Next();<BR>my $count = $nextgroup->Name;<BR>my ($status, $msg) = $self->TicketObj->SetQueue($count);<BR>if($self->TicketObj->Subject =~/TemporaryAccess/i)<BR>{<BR>my $TicketObjItem = RT::Ticket->new(RT::CurrentUser->new($RT::SystemUser));<BR>my $TicketId = $TicketObjItem->Create(Queue => $count, Type => "Ticket", RefersTo => $self->TicketObj->Id);<BR>$TicketObjItem->SetSubject("Delete $self->TicketObj->Subject");<BR>$TicketObjItem->AddCustomFieldValue( Field => '40', Value => "Access", RecordTransaction => 1 );<BR>unless( $status ) <BR>{<BR>$RT::Logger->warning( "Couldn't set Access as value for CF TicketType". $msg );<BR>return undef;<BR>}<BR>$TicketObjItem->AddCustomFieldValue( Field => '41', Value => "Separation", RecordTransaction => 1 );<BR>unless( $status )<BR>{<BR>$RT::Logger->warning( "Couldn't set Separation as value for CF AccessManagementType". $msg );<BR>return undef;<BR>}<BR>$TicketObjItem->SetDue(Format => "Date", Value => $self->TicketObj->Due);<BR>}<BR> <BR>-------------------------------------------------------------------------------------------------------------<BR> <BR>Ticket1 is sent in via email with Set-Due: so Ticket1's Due is pulled from the email.<BR> <BR>It looks like the Due date is trying to be set, but doesn't actually set it. Ticket1 says:<BR> <BR><BR>
<DIV class="EC_ticket-transaction dates even">
<TABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
<TBODY>
<TR>
<TD class=EC_type vAlign=top rowSpan=2><A href="http://ricotest.zumiez.com/Ticket/Display.html?id=8322#txn-154538" target=_blank name=txn-154538><U><FONT face="" color=#0000ff>#</FONT></U></A> </TD>
<TD class=EC_date>Mon Nov 06 18:24:55 2006</TD>
<TD class=EC_description>RT_System - Due changed from Not set to Not set </TD>
<TD class=EC_time-taken></TD>
<TD class=EC_actions> </TD></TR>
<TR>
<TD class=EC_content colSpan=4></TD></TR></TBODY></TABLE></DIV>
<DIV class="EC_ticket-transaction dates odd">
<TABLE cellSpacing=0 cellPadding=2 width="100%" border=0>
<TBODY>
<TR>
<TD class=EC_type vAlign=top rowSpan=2><A href="http://ricotest.zumiez.com/Ticket/Display.html?id=8322#txn-154539" target=_blank name=txn-154539><U><FONT face="" color=#0000ff>#</FONT></U></A> <A name=lasttrans> </A> </TD>
<TD class=EC_date>Mon Nov 06 18:24:55 2006</TD>
<TD class=EC_description>RT_System - Due changed from Thu Nov 09 16:00:00 2006 to Not set</TD></TR></TBODY></TABLE></DIV> <BR>and Ticket2 says:<BR> <BR><TR><TD class=EC_type valign="top" rowspan="2"><A href="http://ricotest.zumiez.com/Ticket/Display.html?id=8323#txn-154535" target=_blank name=txn-154535><U><FONT face="" color=#0000ff>#</FONT></U></A> <A name=lasttrans> </A> </TD><TD class=EC_date>Mon Nov 06 18:24:54 2006</TD> <TD class=EC_description>RT_System - Due changed from Not set to Not set </TD><TD class=EC_time-taken></TD><TD class=EC_actions> </TD> <BR> <BR>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?<BR> <BR>Also, the subject of Ticket2 ends up coming out like "<FONT face="" size=2>Delete RT::Action::UserDefined=HASH(0xb57baa8)->TicketObj->Subject". Any ideas on this either?</FONT><BR> <BR>Any help is greatly appreciated.<BR> <BR>Thanks,<BR>Jared<BR> <BR></TR><TR><TD class=EC_content colspan="4"></TD></TR><BR><BR>
<HR>
Try the next generation of search with Windows LiveT Search today! <A href="http://search.live.com/" target=_blank>Try it!</A> </BLOCKQUOTE><br /><hr />Get the new Windows Live Messenger! <a href='http://get.live.com/messenger/overview' target='_new'>Try it!</a></body>
</html>