Custom scrip to set status to complete to parent ticket when child is resolved

Hi All,

I am trying to find a scrip that automatically closes parent tickets when the child is resolved, rejected or completed.

The scenario is as follows:

  1. A ticket is opened under Queue A with the problem description
  2. A child ticket in Queues B, C, D, E and F is opened
  3. Resolution is offered for the problem in Queue A in one of Queues B, C, D, E and F
  4. Owner of Queues B, C, D, E and F mark the child ticket as resolved, rejected or completed.
  5. Parent ticket status is automatically set to complete from any other status once the child status changed to resolved, rejected or completed.

I would really appreciate some help.

Are the tickets linked hierarchically as parent and child, in the ticket metadata?

1 Like

Yes, tickets are linked as parent and child.

You cant do what you want then, as all children of a parent must be resolved, before the parent can be. You might be able to do what you want with “Refers To”: Ticket metadata - RT 4.4.4 Documentation - Best Practical

You could then check the ticket metadata for the “parent” and run SetStatus against it.

1 Like

Thanks G.Booth for your help,

i will review the provided link.

You could have the scrip resolve all the children and then the parent, or you could use the “depends on” relationship instead of the parent child relationship

1 Like

I had a look at the provided link, the action i want to be performed is close parent after child is closed.

As i could understand (i am quite new to RT), you cannot close the parent unless the children are closed. Am i correct in saying so?

If so, then i think it would be possible to create a scrip that once the child is closed manually from whoever is handling the ticket parent is automatically closed?

Thanks for your help. Really appreciate it.

Yes as long as there arent other children, in which case you’d need to look at the comment Knation gave and look at shutting all of the children down and then the parent. As an aside, you might find it easier just to find the parent ticket, bulk update the children to closed (via the links) and then close the parent, all via the GUI

1 Like

Howdy,

The following scrip does the opposite, i.e. closing ReferredToBy when closing the parent. You should be able to reverse it quite easily.

Condition: On Resolve
Action: User Defined

my $flood_search = RT::Tickets->new($RT::SystemUser);
$flood_search->FromSQL("Queue = 'QUEUENAME' AND ReferredToBy = " . $self->TicketObj->Id);

while(my $ticket = $flood_search->Next) {
    $ticket->SetStatus("resolved");
}
1;
1 Like

Hi Jonathan,

Thanks for your reply. I will look into it and try to reverse it accordingly.

Much appreciated!

Ryan