Scrip to resolve parent when all children resolved

I have a scrip in place that creates 4 child tickets in queue B upon creation
of a ticket (the parent) in queue A. Is there a way for the parent to check
the status of the child tickets and automatically resolve itself when the
last of the child tickets is resolved?

Thank you,
Jonathan

RT 3.6.5, MySQL
View this message in context: http://old.nabble.com/Scrip-to-resolve-parent-when-all-children-resolved-tp28964429p28964429.html

I have a scrip in place that creates 4 child tickets in queue B upon creation
of a ticket (the parent) in queue A. Is there a way for the parent to check
the status of the child tickets and automatically resolve itself when the
last of the child tickets is resolved?

Logically, you want to resolve the parent in the On Resolve clause of
the last child. I thought there was a resolve parent scrip on the
wiki, but I may be wrong.

-kevin

Take this both Wiki Links to create the scrips you need:

http://wiki.bestpractical.com/view/OpenTicketOnAllMemberResolve
http://wiki.bestpractical.com/view/OpenTicketOnAllMemberResolve
http://wiki.bestpractical.com/view/OpenDependantsOnResolve

http://wiki.bestpractical.com/view/OpenDependantsOnResolveTorsten2010/6/22 Jonathan Rummel jrummel@imapp.com

I have a scrip in place that creates 4 child tickets in queue B upon
creation
of a ticket (the parent) in queue A. Is there a way for the parent to
check
the status of the child tickets and automatically resolve itself when the
last of the child tickets is resolved?

Thank you,
Jonathan

RT 3.6.5, MySQL

View this message in context:
http://old.nabble.com/Scrip-to-resolve-parent-when-all-children-resolved-tp28964429p28964429.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

MFG

Torsten Brumm

http://www.brumm.me

I have a scrip in place that creates 4 child tickets in queue B upon creation
of a ticket (the parent) in queue A. Is there a way for the parent to check
the status of the child tickets and automatically resolve itself when the
last of the child tickets is resolved?

I use a scrip with condition OnResolve that close parents if they have all
children (except the current one) resolved. Here is the action:

# Loop on each relation type (Depends, Refers, Member)
foreach my $type ( keys %{$self->TicketObj->LINKDIRMAP} ) {
    my $target = $self->TicketObj->LINKDIRMAP->{$type}->{Target};
    my $base = $self->TicketObj->LINKDIRMAP->{$type}->{Base};
    # Skip merges
    next if ( $target =~ /merge/i );

    # Loop on parents
    while ( my $Parent = $self->TicketObj->$target->Next ) {
        # Only for tickets links
        next unless ( $Parent->BaseObj && $Parent->BaseObj->isa('RT::Ticket') );
        my $ParentTicket = $Parent->BaseObj;
        # Only for unresolved parents
        next if ( $ParentTicket->Status eq 'resolved' );
        my $to_be_resolved = 1;

        # Loop on Childrens
        while ( my $Child = $ParentTicket->$base->Next ) {
            # Only for tickets links
            next unless ( $Child->TargetObj && $Child->TargetObj->isa('RT::Ticket') );
            my $ChildTicket = $Child->TargetObj;
            # Current ticket doesn't matters
            next if ( $ChildTicket->Id == $self->TicketObj->Id );
            # Stop if unresolved child found
            if ( $ChildTicket->Status ne 'resolved' ) {
                $to_be_resolved = 0;
                last;
            }
        }
        if ( $to_be_resolved ) {
            $ParentTicket->SetStatus('resolved');
        }
    }
}

return (1);