Open Ticket On Resolve Of Dependants?

Hello,

I am new to Perl and RT Scrips, and I need to set up a scrip that will
change the parent ticket from new to open when all dependent tickets
have been resolved, or have it perform only on the Subject of one
Specific Ticket.

I found this script below and it works on the first ticket resolved. How
can I modify this scrip to either wait till all dependents are resolved
or resolved on a specific subject?

I have tried this to get it to work on the subject, but to no
avail. next unless( $l->BaseObj->Subject eq
’Change-Coordinator-Approval’);

How can I find or figure out what objects are available for the
different sections of a ticket? etc.

Condition: On Status Change
Action: User Defined
Template: Global Template Blank

Customer action: return 1;
Custom action cleanup code:
return 1 if ($self->TransactionObj->NewValue !~
/^(?:resolved|deleted|rejected)$/);
my $DepOnBy = $self->TicketObj->DependedOnBy;
while( my $l = $DepOnBy->Next ) {
next unless( $l->BaseURI->IsLocal );
next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/ );

  # here you can add any action
  # see also example below
  $l->BaseObj->SetStatus('open');
}
$DepOnBy = undef;
return 1;

Any thoughts or ideas?

Thanks in advance

The information transmitted in this email is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this email in error, please contact the sender and delete the email from your computer.

Hi Kevin,

this scrip open the parent ticket if all dependent are closed:

my $deps = $self->TicketObj->DependedOnBy;
while( my $link = $deps->Next ) {
next unless $link->BaseURI->IsLocal;
my $dep = $link->BaseObj;
next if $dep->QueueObj->IsInactiveStatus($dep->Status);
$dep->SetStatus(‘open’) unless $dep->HasUnresolvedDependencies;
}
return 1;

Note that you have to change your scrip condition to “On Close”.

I don’t understand the part with the ticket subject. Maybe you can
figure it out by yourself with my suggestion or you can explain it a
little bit more what you want to do.

ChrisAm 05.02.2013 17:03, schrieb Kevin Comer:

Hello,

I am new to Perl and RT Scrips, and I need to set up a scrip that will
change the parent ticket from new to open when all dependent tickets
have been resolved, or have it perform only on the Subject of one
Specific Ticket.

I found this script below and it works on the first ticket resolved. How
can I modify this scrip to either wait till all dependents are resolved
or resolved on a specific subject?

I have tried this to get it to work on the subject, but to no
avail. next unless( $l->BaseObj->Subject eq
‘Change-Coordinator-Approval’);

How can I find or figure out what objects are available for the
different sections of a ticket? etc.

Condition: On Status Change
Action: User Defined
Template: Global Template Blank

Customer action: return 1;
Custom action cleanup code:
return 1 if ($self->TransactionObj->NewValue !~
/^(?:resolved|deleted|rejected)$/);
my $DepOnBy = $self->TicketObj->DependedOnBy;
while( my $l = $DepOnBy->Next ) {
next unless( $l->BaseURI->IsLocal );
next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/ );

 # here you can add any action
 # see also example below
 $l->BaseObj->SetStatus('open');

}
$DepOnBy = undef;
return 1;

Any thoughts or ideas?

Thanks in advance

The information transmitted in this email is intended only for the
person or entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination
or other use of, or taking of any action in reliance upon this
information by persons or entities other than the intended recipient is
prohibited. If you received this email in error, please contact the
sender and delete the email from your computer.

Thanks Christian

Our Process:

  1. Parent Ticket created, & Custom Fields Selected →
  2. scrip Creates multiple Approval tickets with Specific Subjects →
  3. When All Approvals are completed, Parent ticket is set to open via
    script →
  4. on Status change to Open of Parent ticket, → a new Implementation
    ticket is created to a Queue based on Custom Field from Parent Ticket.
  5. New Implementation ticket is then ready to be worked and Resolved.
  6. Once All tickets are Resolved the Parent ticket can be Resolved
  7. TBD (On Completion create a new Review ticket/s for Finial Approval)

The solution to open based on Subject would fire when a ticket with a
Specific Subject line was resolved.

In our case this is an approval process and there will be several
approvals, such as Manager, Security, Change Coordinator etc.
If the scrip sets the parent ticket to open based on Subject, our
process would be to resolve the Change Coordinator ticket last. The
other Approval tickets could be approved anytime before the Change
Coordinator. Once all approvals are completed the Implementation ticket
is then ready to be worked.On 02/06/2013 03:53 AM, Christian Loos wrote:

Hi Kevin,

this scrip open the parent ticket if all dependent are closed:

my $deps = $self->TicketObj->DependedOnBy;
while( my $link = $deps->Next ) {
next unless $link->BaseURI->IsLocal;
my $dep = $link->BaseObj;
next if $dep->QueueObj->IsInactiveStatus($dep->Status);
$dep->SetStatus(‘open’) unless $dep->HasUnresolvedDependencies;
}
return 1;

Note that you have to change your scrip condition to “On Close”.

I don’t understand the part with the ticket subject. Maybe you can
figure it out by yourself with my suggestion or you can explain it a
little bit more what you want to do.

Chris

Am 05.02.2013 17:03, schrieb Kevin Comer:

Hello,

I am new to Perl and RT Scrips, and I need to set up a scrip that will
change the parent ticket from new to open when all dependent tickets
have been resolved, or have it perform only on the Subject of one
Specific Ticket.

I found this script below and it works on the first ticket resolved. How
can I modify this scrip to either wait till all dependents are resolved
or resolved on a specific subject?

I have tried this to get it to work on the subject, but to no
avail. next unless( $l->BaseObj->Subject eq
‘Change-Coordinator-Approval’);

How can I find or figure out what objects are available for the
different sections of a ticket? etc.

Condition: On Status Change
Action: User Defined
Template: Global Template Blank

Customer action: return 1;
Custom action cleanup code:
return 1 if ($self->TransactionObj->NewValue !~
/^(?:resolved|deleted|rejected)$/);
my $DepOnBy = $self->TicketObj->DependedOnBy;
while( my $l = $DepOnBy->Next ) {
next unless( $l->BaseURI->IsLocal );
next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/ );

  # here you can add any action
  # see also example below
  $l->BaseObj->SetStatus('open');
}
$DepOnBy = undef;
return 1;

Any thoughts or ideas?

Thanks in advance

The information transmitted in this email is intended only for the
person or entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination
or other use of, or taking of any action in reliance upon this
information by persons or entities other than the intended recipient is
prohibited. If you received this email in error, please contact the
sender and delete the email from your computer.

The information transmitted in this email is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this email in error, please contact the sender and delete the email from your computer.

Our Process:

  1. Parent Ticket created, & Custom Fields Selected →
  2. scrip Creates multiple Approval tickets with Specific Subjects →
  3. When All Approvals are completed, Parent ticket is set to open via
    script →
  4. on Status change to Open of Parent ticket, → a new Implementation
    ticket is created to a Queue based on Custom Field from Parent Ticket.
  5. New Implementation ticket is then ready to be worked and Resolved.
  6. Once All tickets are Resolved the Parent ticket can be Resolved
  7. TBD (On Completion create a new Review ticket/s for Finial Approval)

The solution to open based on Subject would fire when a ticket with a
Specific Subject line was resolved.

In our case this is an approval process and there will be several
approvals, such as Manager, Security, Change Coordinator etc.
If the scrip sets the parent ticket to open based on Subject, our
process would be to resolve the Change Coordinator ticket last. The
other Approval tickets could be approved anytime before the Change
Coordinator. Once all approvals are completed the Implementation ticket
is then ready to be worked.

Have you considered using RT’s approvals?
http://bestpractical.com/rt/docs/latest/customizing/approvals.html
rather than building from scratch

-kevin> On 02/06/2013 03:53 AM, Christian Loos wrote:

Hi Kevin,

this scrip open the parent ticket if all dependent are closed:

my $deps = $self->TicketObj->DependedOnBy;
while( my $link = $deps->Next ) {
next unless $link->BaseURI->IsLocal;
my $dep = $link->BaseObj;
next if $dep->QueueObj->IsInactiveStatus($dep->Status);
$dep->SetStatus(‘open’) unless $dep->HasUnresolvedDependencies;
}
return 1;

Note that you have to change your scrip condition to “On Close”.

I don’t understand the part with the ticket subject. Maybe you can
figure it out by yourself with my suggestion or you can explain it a
little bit more what you want to do.

Chris

Am 05.02.2013 17:03, schrieb Kevin Comer:

Hello,

I am new to Perl and RT Scrips, and I need to set up a scrip that will
change the parent ticket from new to open when all dependent tickets
have been resolved, or have it perform only on the Subject of one
Specific Ticket.

I found this script below and it works on the first ticket resolved. How
can I modify this scrip to either wait till all dependents are resolved
or resolved on a specific subject?

I have tried this to get it to work on the subject, but to no
avail. next unless( $l->BaseObj->Subject eq
‘Change-Coordinator-Approval’);

How can I find or figure out what objects are available for the
different sections of a ticket? etc.

Condition: On Status Change
Action: User Defined
Template: Global Template Blank

Customer action: return 1;
Custom action cleanup code:
return 1 if ($self->TransactionObj->NewValue !~
/^(?:resolved|deleted|rejected)$/);
my $DepOnBy = $self->TicketObj->DependedOnBy;
while( my $l = $DepOnBy->Next ) {
next unless( $l->BaseURI->IsLocal );
next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/ );

 # here you can add any action
 # see also example below
 $l->BaseObj->SetStatus('open');

}
$DepOnBy = undef;
return 1;

Any thoughts or ideas?

Thanks in advance

The information transmitted in this email is intended only for the
person or entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination
or other use of, or taking of any action in reliance upon this
information by persons or entities other than the intended recipient is
prohibited. If you received this email in error, please contact the
sender and delete the email from your computer.

The information transmitted in this email is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this email in error, please contact the sender and delete the email from your computer.


Help improve RT by taking our user survey: https://www.surveymonkey.com/s/N23JW9T

The reason I’m not using the approval process, is in all my attempts to get
it working has been for NOT.

So I abandoned it to created my own to which works except for the resolve,
right now it opens the parent ticket on resolve of the first ticket. I would
prefer that it did not change the status to open until all of the tickets
are resolved or on resolve of a specific subject line of a ticket. I’m the
only one setting this up and I have no resources here that knows perl.

View this message in context: http://requesttracker.8502.n7.nabble.com/Open-Ticket-On-Resolve-Of-Dependants-tp52605p52660.html

Hi Kevin,

I can’t understand that my scrip didn’t work for you as we use this
scrip in our RT without any problem.

If you change your line
$l->BaseObj->SetStatus(‘open’);
to
$l->BaseObj->SetStatus(‘open’)
unless $l->BaseObj->HasUnresolvedDependencies;
the parent ticket is only open until all child tickets are resolved.

ChrisAm 06.02.2013 20:36, schrieb Kevin Comer:

Christian,

I tried this script you sent and was not able to get any results.

The script in the first post does work, just not in the way we would like.

we would like for the script to not fire until all the tickets have been
resolved.
How can I modify this script?

Condition: On Status Change
Action: User Defined
Template: Global Template Blank

Customer action: return 1;
Custom action cleanup code:
return 1 if ($self->TransactionObj->NewValue !~
/^(?:resolved|deleted|rejected)$/);
my $DepOnBy = $self->TicketObj->DependedOnBy;
while( my $l = $DepOnBy->Next ) {
next unless( $l->BaseURI->IsLocal );
next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/ );

 # here you can add any action
 # see also example below
 $l->BaseObj->SetStatus('open');

}
$DepOnBy = undef;
return 1;

Kevin Comer

Thanks

This code added to the original script (OpenDependantsOnResolve) works great
Thank You!

$l->BaseObj->SetStatus(‘open’)
unless $l->BaseObj->HasUnresolvedDependencies;

Condition: On Status Change
Action: User Defined
Template: Global Template Blank

Customer action: return 1;

Custom action cleanup code:
return 1 if ($self->TransactionObj->NewValue !~
/^(?:resolved|deleted|rejected)$/);
my $DepOnBy = $self->TicketObj->DependedOnBy;
while( my $l = $DepOnBy->Next ) {
next unless( $l->BaseURI->IsLocal );
next unless( $l->BaseObj->Status =~ /^(?:new|open|stalled)$/ );

# here you can add any action
# see also example below
$l->BaseObj->SetStatus('open')
unless $l->BaseObj->HasUnresolvedDependencies;

}
$DepOnBy = undef;
return 1;

View this message in context: http://requesttracker.8502.n7.nabble.com/Open-Ticket-On-Resolve-Of-Dependants-tp52605p52701.html