Why doesn't this scrip code work?

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;
$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)

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@lists.bestpractical.com
The rt-users Archives

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm

Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.

It would help if someone could extend my understanding of bases
and targets.

Also, I lost the link to the RTFM for RT3. Anyone?

Thanks for the help Jesse and all!

-ToddOn 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@lists.bestpractical.com
The rt-users Archives

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm


Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.

I thing I understand now.

MemberOf gave a collection of links. Each link
points from Ticket to the MemberOf (in this case
it is a parent). So the end of the arrow (link)
with the arrowhead is the target (parent), and the
end of the arrow without the arrowhead is the base
(the ticket, or child in this case.)

Thanks!

-ToddOn Tue, Jan 27, 2004 at 01:29:07PM -0500, Todd Chapman wrote:

It would help if someone could extend my understanding of bases
and targets.

Also, I lost the link to the RTFM for RT3. Anyone?

Thanks for the help Jesse and all!

-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@lists.bestpractical.com
The rt-users Archives

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm


Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.


rt-users mailing list
rt-users@lists.bestpractical.com
The rt-users Archives

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm

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.

-ToddOn 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@lists.bestpractical.com
The rt-users Archives

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm


Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.

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…

-ToddOn 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@lists.bestpractical.com
The rt-users Archives

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm


Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.


rt-users mailing list
rt-users@lists.bestpractical.com
The rt-users Archives

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm

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);
    }

Actually, that code predates Ticket->Create’s ability to accept links as
attributes. it could be refactored to pass the linking code into create.
I’ve opened a ticket about this issue.

Now to figure out how to create a custome scrip condition…
Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.

Jesse,

Allthough you may be afraid of my RT code at this point,
I am interested in getting involved with RT development.
I would take a crack at the changes below but I have
some questions about the development process that were
never answered in this post:

http://lists.fsck.com/pipermail/rt-devel/2004-January/005303.html

…wanting to contribute

-ToddOn Tue, Jan 27, 2004 at 04:01:34PM -0500, Jesse Vincent wrote:

On Tue, Jan 27, 2004 at 03:06:30PM -0500, Todd Chapman wrote:

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);
    }

Actually, that code predates Ticket->Create’s ability to accept links as
attributes. it could be refactored to pass the linking code into create.
I’ve opened a ticket about this issue.

Now to figure out how to create a custome scrip condition…

Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.

Jesse,

Allthough you may be afraid of my RT code at this point,
I am interested in getting involved with RT development.
I would take a crack at the changes below but I have
some questions about the development process that were
never answered in this post:

http://lists.fsck.com/pipermail/rt-devel/2004-January/005303.html

The short version is that you submit your patches to rt-bugs@fsck.com.
If you’re making patches for intended inclusion in the rt codebase,
you’ll have to patch the RT core libraries and generate unidiffs based
on those changes.

Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.

Will I get a notice if the patch is rejected. I don’t like
the idea of submitting to a black hole.

-ToddOn Tue, Jan 27, 2004 at 04:12:16PM -0500, Jesse Vincent wrote:

On Tue, Jan 27, 2004 at 03:18:44PM -0500, Todd Chapman wrote:

Jesse,

Allthough you may be afraid of my RT code at this point,
I am interested in getting involved with RT development.
I would take a crack at the changes below but I have
some questions about the development process that were
never answered in this post:

http://lists.fsck.com/pipermail/rt-devel/2004-January/005303.html

The short version is that you submit your patches to rt-bugs@fsck.com.
If you’re making patches for intended inclusion in the rt codebase,
you’ll have to patch the RT core libraries and generate unidiffs based
on those changes.


Request Tracker... So much more than a help desk — Best Practical Solutions – Trouble Ticketing. Free.

To get a good understanding of base and targets, look at the Links table
with some kind of graphical database table viewer like phpadmin. That will
explain just everything you need to know about how the base, target, and
type structures and methods work.

A.J.From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Todd Chapman
Sent: Tuesday, January 27, 2004 1:29 PM
To: Jesse Vincent
Cc: rt-users@lists.fsck.com
Subject: Re: [rt-users] Why doesn’t this scrip code work?

It would help if someone could extend my understanding of bases
and targets.

Also, I lost the link to the RTFM for RT3. Anyone?

Thanks for the help Jesse and all!

-Todd