[rt-users] Why doesn't this scrip code work?
Todd Chapman
rt at chaka.net
Tue Jan 27 15:06:30 EST 2004
Nevermind. Web.pm tells all:
my ( $id, $Trans, $ErrMsg ) = $Ticket->Create(%create_args);
unless ( $id && $Trans ) {
Abort($ErrMsg);
}
my @linktypes = qw( DependsOn MemberOf RefersTo );
foreach my $linktype (@linktypes) {
foreach my $luri ( split ( / /, $ARGS{"new-$linktype"} ) ) {
$luri =~ s/\s*$//; # Strip trailing whitespace
my ( $val, $msg ) = $Ticket->AddLink(
Target => $luri,
Type => $linktype
);
push ( @Actions, $msg ) unless ($val);
}
Now to figure out how to create a custome scrip condition...
-Todd
On Tue, Jan 27, 2004 at 02:55:11PM -0500, Todd Chapman wrote:
> Jesse,
>
> If I change the scrip condition to On Create, the code no
> longer works. Is this because the scrip is run before the
> link is created? How can I refer to the parent of a ticket
> in an On Create scrip?
>
> Thanks.
>
> -Todd
>
> On Tue, Jan 27, 2004 at 02:12:51PM -0500, Jesse Vincent wrote:
> >
> >
> >
> > On Tue, Jan 27, 2004 at 01:19:33PM -0500, Todd Chapman wrote:
> > > Ticket #152 is a Child of Ticket #151.
> > >
> > > I created an On Correspond scrip with this preparation code:
> > >
> > > my $Ticket = $self->TicketObj;
> > > $RT::Logger->debug("Ticket ID: " . $Ticket->id);
> > > my $members = $Ticket->MemberOf;
> > > my $link = $members->First;
> > > my $parent = $link->BaseObj;
> >
> >
> > Ticket is a MemberOf *. You want to look at targets, not bases
> > > $RT::Logger->debug("BaseObj ID: " . $parent->id);
> > >
> > >
> > > I would expect BaseObj ID to be 151. Not so. The Ticket
> > > ID and BaseObjID print as 152.
> > >
> > > What am I missing?
> > >
> > > Thanks!
> > >
> > > -Todd (RT 3.0.8)
> > >
> > > _______________________________________________
> > > rt-users mailing list
> > > rt-users at lists.bestpractical.com
> > > http://lists.bestpractical.com/mailman/listinfo/rt-users
> > >
> > > Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm
> > >
> >
> > --
> > http://www.bestpractical.com/rt -- Trouble Ticketing. Free.
> _______________________________________________
> rt-users mailing list
> rt-users at lists.bestpractical.com
> http://lists.bestpractical.com/mailman/listinfo/rt-users
>
> Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm
More information about the rt-users
mailing list