Setting RefersTo links

Hello,

I’m trying to set the RefersTo link to another ticket while creating it, but am not having any success.

I have the following in Custom action cleanup code:

1;
my $AttachObj = $self->TransactionObj->Attachments->First;# go out if content is not text!unless( $AttachObj->ContentType =~ /^text/ ) {
return 1;}
my $content = $AttachObj->Content;
if( $content =~ m/^\RefersTo:\E\s*(\S+)\s*$/m ) {
$self->TicketObj->RefersTo( $1 );}

if( $content =~ m/^\QSet-Status:\E\s*(\S+)\s*$/m ) {
$self->TicketObj->SetStatus( $1 );}

I’m able to set the status but not the Refers to link. Any help is appreciated.
Thanks,
Jared
Download Messenger. Start an i’m conversation. Support a cause. Join now.
http://im.live.com/messenger/im/home/?source=TAGWL_MAY07

At Friday 5/11/2007 03:22 PM, Jared Hanks wrote:

Hello,

I’m trying to set the RefersTo link to another ticket while creating
it, but am not having any success.

I have the following in Custom action cleanup code:

1;
my $AttachObj = $self->TransactionObj->Attachments->First;

go out if content is not text!

unless( $AttachObj->ContentType =~ /^text/ ) {
return 1;
}
my $content = $AttachObj->Content;
if( $content =~ m/^\RefersTo:\E\s*(\S+)\s*$/m ) {
$self->TicketObj->RefersTo( $1 );
}

if( $content =~ m/^\QSet-Status:\E\s*(\S+)\s*$/m ) {
$self->TicketObj->SetStatus( $1 );
}

I’m able to set the status but not the Refers to link. Any help is
appreciated.

Thanks,
Jared

Jared,

$self->TicketObj->RefersTo will return the link information for the
ticket. To set links, you should use AddLink (see Ticket API).

Steve

Thanks. I was able to figure it out. I used the following:

if( $content =~ m/^\QRefersTo:\E\s*(\S+)\s*$/m ) { $self->TicketObj->AddLink(Type=> ‘RefersTo’, Target=> $1 );}

Date: Fri, 11 May 2007 15:42:06 -0400> To: rt-users@lists.bestpractical.com> From: sturner@MIT.EDU> Subject: Re: [rt-users] Setting RefersTo links> > At Friday 5/11/2007 03:22 PM, Jared Hanks wrote:> >Hello,> >> >I’m trying to set the RefersTo link to another ticket while creating > >it, but am not having any success.> >> >I have the following in Custom action cleanup code:> >> >1;> >my $AttachObj = $self->TransactionObj->Attachments->First;> ># go out if content is not text!> >unless( $AttachObj->ContentType =~ /^text/ ) {> > return 1;> >}> >my $content = $AttachObj->Content;> >if( $content =~ m/^\RefersTo:\E\s*(\S+)\s*$/m ) {> > $self->TicketObj->RefersTo( $1 );> >}> >> >if( $content =~ m/^\QSet-Status:\E\s*(\S+)\s*$/m ) {> > $self->TicketObj->SetStatus( $1 );> >}> >> >I’m able to set the status but not the Refers to link. Any help is > >appreciated.> >> >Thanks,> >Jared> > Jared,> > $self->TicketObj->RefersTo will return the link information for the > ticket. To set links, you should use AddLink (see Ticket API).> > Steve > > _______________________________________________> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users> > Community help: http://wiki.bestpractical.com> Commercial support: sales@bestpractical.com> > > Discover RT’s hidden secrets with RT Essentials from O’Reilly Media. > Buy a copy at http://rtbook.bestpractical.com
See what you’re getting into…before you go there.
http://newlivehotmail.com/?ocid=TXT_TAGWL_migration_HM_viral_preview_0507