Set Due Date - Child Tickets

Hi ,

I’m trying to set the Due date of the child Ticket.But my scrips is giving some error.Please find below the Custom action clean up code used for the same:

my $link = $self->TicketObj->DependedOnBy->Next;
my $duedate = RT::Date->new($RT::SystemUser);
my $hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
$link->BaseObj->SetDue($duedate->ISO);
return 1;

Error : Log File

[Wed Nov 25 09:08:30 2009] [debug]: Committing scrip #11 on txn #114748 of ticket #1972 (/usr/lib/perl5/vendor_perl/5.10.0/RT/Scrips_Overlay.pm:190)
[Wed Nov 25 09:08:30 2009] [error]: Scrip 125 Commit failed: Can’t call method “BaseObj” on an undefined value at (eval 1531) line 8.

Any help?

Regards,
Tony

DISCLAIMER:

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

Hi Tony,
i think the problem is my $link = $self->TicketObj->DependedOnBy->Next;
which gives you back all possible DependedOnBy Tickets, also if you have
more. I tried something similar last week.

Attached a piece of code to find all deponby tickets and update the deponbys
with something.

my $DepOnBy = $self->TicketObj->DependedOnBy;
my $dep;
my $l;
while( $dep = $DepOnBy->Next ) {
next unless( $dep->BaseURI->IsLocal );
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while( $l = $Members->Next ) {
next unless( $l->TargetURI->IsLocal );
next unless( $l->BaseObj->Queue =~ /^(?:1043|612|613)$/ );

$self->TicketObj->AddLink(Type=>‘MemberOf’,Base=>$l->BaseObj->Id);
}
}
return 1;

In my case i added to all deponby tickets a new member, you can replace this
with your setdue part i think,

Torsten2009/11/25 TONY JOHN - ERS, HCL Tech tonyjohn@hcl.in

Hi ,

I’m trying to set the Due date of the child Ticket.But my scrips is
giving some error.Please find below the Custom action clean up code used
for the same:

my $link = $self->TicketObj->DependedOnBy->Next;

my $duedate = RT::Date->new($RT::SystemUser);

my $hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

$link->BaseObj->SetDue($duedate->ISO);

return 1;

Error : Log File

[Wed Nov 25 09:08:30 2009] [debug]: Committing scrip #11 on txn #114748 of
ticket #1972 (/usr/lib/perl5/vendor_perl/5.10.0/RT/Scrips_Overlay.pm:190)

[Wed Nov 25 09:08:30 2009] [error]: Scrip 125 Commit failed: Can’t call
method “BaseObj” on an undefined value at (eval 1531) line 8.

Any help?

Regards,

Tony

DISCLAIMER:

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.



The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.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
http://www.elektrofeld.de

Hi Torsten,

I tried this Scrip but it isn’t working

my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
my $DepOnBy = $self->TicketObj->DependedOnBy;
$RT::Logger->debug(“BaseObj called”);
while (my $dep = $DepOnBy->Next) {
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while(my $l = $Members->Next ) {
$l->BaseObj->SetDue($duedate->ISO);
}
$RT::Logger->debug(“BaseObj called”);
}
return 1;

Regards,
TonyFrom: Torsten Brumm [mailto:torsten.brumm@googlemail.com]
Sent: Wednesday, November 25, 2009 5:02 PM
To: TONY JOHN - ERS, HCL Tech
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Set Due Date - Child Tickets

Hi Tony,
i think the problem is my $link = $self->TicketObj->DependedOnBy->Next; which gives you back all possible DependedOnBy Tickets, also if you have more. I tried something similar last week.

Attached a piece of code to find all deponby tickets and update the deponbys with something.

my $DepOnBy = $self->TicketObj->DependedOnBy;
my $dep;
my $l;
while( $dep = $DepOnBy->Next ) {
next unless( $dep->BaseURI->IsLocal );
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while( $l = $Members->Next ) {
next unless( $l->TargetURI->IsLocal );
next unless( $l->BaseObj->Queue =~ /^(?:1043|612|613)$/ );
$self->TicketObj->AddLink(Type=>‘MemberOf’,Base=>$l->BaseObj->Id);
}
}
return 1;

In my case i added to all deponby tickets a new member, you can replace this with your setdue part i think,

Torsten
2009/11/25 TONY JOHN - ERS, HCL Tech <tonyjohn@hcl.inmailto:tonyjohn@hcl.in>
Hi ,

I’m trying to set the Due date of the child Ticket.But my scrips is giving some error.Please find below the Custom action clean up code used for the same:

my $link = $self->TicketObj->DependedOnBy->Next;
my $duedate = RT::Date->new($RT::SystemUser);
my $hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
$link->BaseObj->SetDue($duedate->ISO);
return 1;

Error : Log File

[Wed Nov 25 09:08:30 2009] [debug]: Committing scrip #11 on txn #114748 of ticket #1972 (/usr/lib/perl5/vendor_perl/5.10.0/RT/Scrips_Overlay.pm:190)
[Wed Nov 25 09:08:30 2009] [error]: Scrip 125 Commit failed: Can’t call method “BaseObj” on an undefined value at (eval 1531) line 8.

Any help?

Regards,
Tony

DISCLAIMER:

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.

It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in

this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.

Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of

this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have

received this email in error please delete it and notify the sender immediately. Before opening any mail and

attachments please check them for viruses and defect.

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.commailto:sales@bestpractical.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

Hi Tony,

i think this is the problem:

$l->BaseObj->SetDue($duedate->ISO);

should by $l->TicketObj->SetDue($duedate->ISO);

Like this:

your calculations

my $duedate = RT::Date->new($RT::SystemUser);

my $bus_hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

find depon ticket

my $DepOnBy = $self->TicketObj->DependedOnBy;

$RT::Logger->debug(“BaseObj called”);

loop through all deponbys

while (my $dep = $DepOnBy->Next) {

my $systicket = RT::Ticket->new($RT::SystemUser);



# Get ID of all deponby tickets and load from id the ticketobj

$systicket->Load($dep->BaseObj->Id);

my $Members = $systicket->Members;

from here we have all our depended on by tickets, we will set the due here

while(my $l = $Members->Next ) {

$l->TicketObj->SetDue($duedate->ISO);

}

$RT::Logger->debug(“BaseObj called”);

}

return 1;

Otherwise, let the logger give out the content of the variables.
Torsten

Kuehne + Nagel (AG & Co.) KG, Geschaeftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persoenlich haftende Gesellschaft: Kuehne & Nagel A.G., Sitz: Contern/Luxemburg Geschaeftsfuehrender Verwaltungsrat: Klaus-Michael KuehneVon: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von TONY JOHN - ERS, HCL Tech
Gesendet: Mittwoch, 25. November 2009 12:53
An: Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Set Due Date - Child Tickets

Hi Torsten,

I tried this Scrip but it isn’t working

my $duedate = RT::Date->new($RT::SystemUser);

my $bus_hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

my $DepOnBy = $self->TicketObj->DependedOnBy;

$RT::Logger->debug(“BaseObj called”);

while (my $dep = $DepOnBy->Next) {

my $systicket = RT::Ticket->new($RT::SystemUser);

$systicket->Load($dep->BaseObj->Id);

my $Members = $systicket->Members;

while(my $l = $Members->Next ) {

$l->BaseObj->SetDue($duedate->ISO);

}

$RT::Logger->debug(“BaseObj called”);

}

return 1;

Regards,

Tony

From: Torsten Brumm [mailto:torsten.brumm@googlemail.com]
Sent: Wednesday, November 25, 2009 5:02 PM
To: TONY JOHN - ERS, HCL Tech
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Set Due Date - Child Tickets

Hi Tony,

i think the problem is my $link = $self->TicketObj->DependedOnBy->Next; which gives you back all possible DependedOnBy Tickets, also if you have more. I tried something similar last week.

Attached a piece of code to find all deponby tickets and update the deponbys with something.

my $DepOnBy = $self->TicketObj->DependedOnBy;
my $dep;
my $l;
while( $dep = $DepOnBy->Next ) {
next unless( $dep->BaseURI->IsLocal );
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while( $l = $Members->Next ) {
next unless( $l->TargetURI->IsLocal );
next unless( $l->BaseObj->Queue =~ /^(?:1043|612|613)$/ );
$self->TicketObj->AddLink(Type=>‘MemberOf’,Base=>$l->BaseObj->Id);
}
}
return 1;

In my case i added to all deponby tickets a new member, you can replace this with your setdue part i think,

Torsten

Hi Tony,
confusing :wink: OK, let us give out more:

my $duedate = RT::Date->new($RT::SystemUser);

my $bus_hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

my $DepOnBy = $self->TicketObj->DependedOnBy;

$RT::Logger->debug(“BaseObj called 1”);

while (my $dep = $DepOnBy->Next) {

$RT::Logger->debug("DepOnTickets: $dep->BaseObj->Id"); 

my $systicket = RT::Ticket->new($RT::SystemUser);

$systicket->Load($dep->BaseObj->Id);

and from here stupid copy and paste from my scrip :wink: i’m searching here backwards real child tickets, you searching for Depends on

my $Members = $systicket->Members;

my $Members = $systicket->DependsOn;

while(my $l = $Members->Next ) {

$l->TicketObj->SetDue($duedate->ISO);

}

$RT::Logger->debug(“BaseObj called 2”);

}

return 1;Von: Tony John - ERS, HCL Tech [mailto:tonyjohn@hcl.in]
Gesendet: Mittwoch, 25. November 2009 13:23
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID; Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Betreff: RE: [rt-users] Set Due Date - Child Tickets

Hi Torsten,

my $duedate = RT::Date->new($RT::SystemUser);

my $bus_hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

my $DepOnBy = $self->TicketObj->DependedOnBy;

$RT::Logger->debug(“BaseObj called 1”);

while (my $dep = $DepOnBy->Next) {

my $systicket = RT::Ticket->new($RT::SystemUser);

$systicket->Load($dep->BaseObj->Id);

my $Members = $systicket->Members;

while(my $l = $Members->Next ) {

$l->TicketObj->SetDue($duedate->ISO);

}

$RT::Logger->debug(“BaseObj called 2”);

}

return 1;

This scrip also couldn’t set Due Date for the Child Ticket.Only the first RT::Logger was seen in the RT logfile.I think its not entering the loop “while (my $dep = $DepOnBy->Next)”

Any help?

Regards,

Tony

From: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID [mailto:torsten.brumm@Kuehne-Nagel.com]
Sent: Wednesday, November 25, 2009 5:36 PM
To: TONY JOHN - ERS, HCL Tech; Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Subject: AW: [rt-users] Set Due Date - Child Tickets

Hi Tony,

i think this is the problem:

$l->BaseObj->SetDue($duedate->ISO);

should by $l->TicketObj->SetDue($duedate->ISO);

Like this:

your calculations

my $duedate = RT::Date->new($RT::SystemUser);

my $bus_hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

find depon ticket

my $DepOnBy = $self->TicketObj->DependedOnBy;

$RT::Logger->debug(“BaseObj called”);

loop through all deponbys

while (my $dep = $DepOnBy->Next) {

my $systicket = RT::Ticket->new($RT::SystemUser);



# Get ID of all deponby tickets and load from id the ticketobj

$systicket->Load($dep->BaseObj->Id);

my $Members = $systicket->Members;

from here we have all our depended on by tickets, we will set the due here

while(my $l = $Members->Next ) {

$l->TicketObj->SetDue($duedate->ISO);

}

$RT::Logger->debug(“BaseObj called”);

}

return 1;

Otherwise, let the logger give out the content of the variables.
Torsten

Kühne + Nagel (AG & Co.) KG, Geschäftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persönlich haftende Gesellschaft: Kühne & Nagel A.G., Sitz: Contern/Luxemburg, Geschäftsführender Verwaltungsrat: Klaus-Michael Kühne

Von: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von TONY JOHN - ERS, HCL Tech
Gesendet: Mittwoch, 25. November 2009 12:53
An: Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Set Due Date - Child Tickets

Hi Torsten,

I tried this Scrip but it isn’t working

my $duedate = RT::Date->new($RT::SystemUser);

my $bus_hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

my $DepOnBy = $self->TicketObj->DependedOnBy;

$RT::Logger->debug(“BaseObj called”);

while (my $dep = $DepOnBy->Next) {

my $systicket = RT::Ticket->new($RT::SystemUser);

$systicket->Load($dep->BaseObj->Id);

my $Members = $systicket->Members;

while(my $l = $Members->Next ) {

$l->BaseObj->SetDue($duedate->ISO);

}

$RT::Logger->debug(“BaseObj called”);

}

return 1;

Regards,

Tony

From: Torsten Brumm [mailto:torsten.brumm@googlemail.com]
Sent: Wednesday, November 25, 2009 5:02 PM
To: TONY JOHN - ERS, HCL Tech
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Set Due Date - Child Tickets

Hi Tony,

i think the problem is my $link = $self->TicketObj->DependedOnBy->Next; which gives you back all possible DependedOnBy Tickets, also if you have more. I tried something similar last week.

Attached a piece of code to find all deponby tickets and update the deponbys with something.

my $DepOnBy = $self->TicketObj->DependedOnBy;
my $dep;
my $l;
while( $dep = $DepOnBy->Next ) {
next unless( $dep->BaseURI->IsLocal );
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while( $l = $Members->Next ) {
next unless( $l->TargetURI->IsLocal );
next unless( $l->BaseObj->Queue =~ /^(?:1043|612|613)$/ );
$self->TicketObj->AddLink(Type=>‘MemberOf’,Base=>$l->BaseObj->Id);
}
}
return 1;

In my case i added to all deponby tickets a new member, you can replace this with your setdue part i think,

Torsten

Hi Torsten,

my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
my $DepOnBy = $self->TicketObj->DependedOnBy;
$RT::Logger->debug(“BaseObj called 1”);
while (my $dep = $DepOnBy->Next) {
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;

while(my $l = $Members->Next ) {
$l->TicketObj->SetDue($duedate->ISO);
}
$RT::Logger->debug(“BaseObj called 2”);
}
return 1;

This scrip also couldn’t set Due Date for the Child Ticket.Only the first RT::Logger was seen in the RT logfile.I think its not entering the loop “while (my $dep = $DepOnBy->Next)”

Any help?

Regards,
TonyFrom: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID [mailto:torsten.brumm@Kuehne-Nagel.com]
Sent: Wednesday, November 25, 2009 5:36 PM
To: TONY JOHN - ERS, HCL Tech; Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Subject: AW: [rt-users] Set Due Date - Child Tickets

Hi Tony,

i think this is the problem:

$l->BaseObj->SetDue($duedate->ISO);

should by $l->TicketObj->SetDue($duedate->ISO);

Like this:

your calculations

my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);

find depon ticket

my $DepOnBy = $self->TicketObj->DependedOnBy;
$RT::Logger->debug(“BaseObj called”);

loop through all deponbys

while (my $dep = $DepOnBy->Next) {
my $systicket = RT::Ticket->new($RT::SystemUser);

# Get ID of all deponby tickets and load from id the ticketobj
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;

from here we have all our depended on by tickets, we will set the due here

while(my $l = $Members->Next ) {
$l->TicketObj->SetDue($duedate->ISO);
}
$RT::Logger->debug(“BaseObj called”);
}
return 1;

Otherwise, let the logger give out the content of the variables.
Torsten

Kühne + Nagel (AG & Co.) KG, Geschäftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persönlich haftende Gesellschaft: Kühne & Nagel A.G., Sitz: Contern/Luxemburg, Geschäftsführender Verwaltungsrat: Klaus-Michael Kühne

Von: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von TONY JOHN - ERS, HCL Tech
Gesendet: Mittwoch, 25. November 2009 12:53
An: Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Set Due Date - Child Tickets
Hi Torsten,

I tried this Scrip but it isn’t working

my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
my $DepOnBy = $self->TicketObj->DependedOnBy;
$RT::Logger->debug(“BaseObj called”);
while (my $dep = $DepOnBy->Next) {
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while(my $l = $Members->Next ) {
$l->BaseObj->SetDue($duedate->ISO);
}
$RT::Logger->debug(“BaseObj called”);
}
return 1;

Regards,
Tony
From: Torsten Brumm [mailto:torsten.brumm@googlemail.com]
Sent: Wednesday, November 25, 2009 5:02 PM
To: TONY JOHN - ERS, HCL Tech
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Set Due Date - Child Tickets

Hi Tony,
i think the problem is my $link = $self->TicketObj->DependedOnBy->Next; which gives you back all possible DependedOnBy Tickets, also if you have more. I tried something similar last week.

Attached a piece of code to find all deponby tickets and update the deponbys with something.

my $DepOnBy = $self->TicketObj->DependedOnBy;
my $dep;
my $l;
while( $dep = $DepOnBy->Next ) {
next unless( $dep->BaseURI->IsLocal );
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while( $l = $Members->Next ) {
next unless( $l->TargetURI->IsLocal );
next unless( $l->BaseObj->Queue =~ /^(?:1043|612|613)$/ );
$self->TicketObj->AddLink(Type=>‘MemberOf’,Base=>$l->BaseObj->Id);
}
}
return 1;

In my case i added to all deponby tickets a new member, you can replace this with your setdue part i think,

Torsten
2009/11/25 TONY JOHN - ERS, HCL Tech <tonyjohn@hcl.inmailto:tonyjohn@hcl.in>
Hi ,

I’m trying to set the Due date of the child Ticket.But my scrips is giving some error.Please find below the Custom action clean up code used for the same:

my $link = $self->TicketObj->DependedOnBy->Next;
my $duedate = RT::Date->new($RT::SystemUser);
my $hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
$link->BaseObj->SetDue($duedate->ISO);
return 1;

Error : Log File

[Wed Nov 25 09:08:30 2009] [debug]: Committing scrip #11 on txn #114748 of ticket #1972 (/usr/lib/perl5/vendor_perl/5.10.0/RT/Scrips_Overlay.pm:190)
[Wed Nov 25 09:08:30 2009] [error]: Scrip 125 Commit failed: Can’t call method “BaseObj” on an undefined value at (eval 1531) line 8.

Any help?

Regards,
Tony

DISCLAIMER:

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.

It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in

this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.

Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of

this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have

received this email in error please delete it and notify the sender immediately. Before opening any mail and

attachments please check them for viruses and defect.

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.commailto:sales@bestpractical.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

Argh, it is not a good day for coding today…

This should be the correct one:

my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

Update DueTime for Master Ticket

$self->TicketObj->SetDue($duedate->ISO);

Find all DependedOnBy of Master Ticket

my $DepOnBy = $self->TicketObj->DependedOnBy;

while (my $dep = $DepOnBy->Next) {
$RT::Logger->debug(“DepOnTickets: $dep->BaseObj->Id”);
# OK, from this point we have all Tickets DependedOnBy Master Ticket
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
# Now we have the ID of each DependedOnBy Ticket
$systicket->SetDue($duedate->ISO);
$RT::Logger->debug(“BaseObj called 2”);
}
return 1;Von: Tony John - ERS, HCL Tech [mailto:tonyjohn@hcl.in]
Gesendet: Mittwoch, 25. November 2009 13:23
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID; Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Betreff: RE: [rt-users] Set Due Date - Child Tickets

Hi Torsten,

my $duedate = RT::Date->new($RT::SystemUser);

my $bus_hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

my $DepOnBy = $self->TicketObj->DependedOnBy;

$RT::Logger->debug(“BaseObj called 1”);

while (my $dep = $DepOnBy->Next) {

my $systicket = RT::Ticket->new($RT::SystemUser);

$systicket->Load($dep->BaseObj->Id);

my $Members = $systicket->Members;

while(my $l = $Members->Next ) {

$l->TicketObj->SetDue($duedate->ISO);

}

$RT::Logger->debug(“BaseObj called 2”);

}

return 1;

This scrip also couldn’t set Due Date for the Child Ticket.Only the first RT::Logger was seen in the RT logfile.I think its not entering the loop “while (my $dep = $DepOnBy->Next)”

Any help?

Regards,

Tony

From: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID [mailto:torsten.brumm@Kuehne-Nagel.com]
Sent: Wednesday, November 25, 2009 5:36 PM
To: TONY JOHN - ERS, HCL Tech; Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Subject: AW: [rt-users] Set Due Date - Child Tickets

Hi Tony,

i think this is the problem:

$l->BaseObj->SetDue($duedate->ISO);

should by $l->TicketObj->SetDue($duedate->ISO);

Like this:

your calculations

my $duedate = RT::Date->new($RT::SystemUser);

my $bus_hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

find depon ticket

my $DepOnBy = $self->TicketObj->DependedOnBy;

$RT::Logger->debug(“BaseObj called”);

loop through all deponbys

while (my $dep = $DepOnBy->Next) {

my $systicket = RT::Ticket->new($RT::SystemUser);



# Get ID of all deponby tickets and load from id the ticketobj

$systicket->Load($dep->BaseObj->Id);

my $Members = $systicket->Members;

from here we have all our depended on by tickets, we will set the due here

while(my $l = $Members->Next ) {

$l->TicketObj->SetDue($duedate->ISO);

}

$RT::Logger->debug(“BaseObj called”);

}

return 1;

Otherwise, let the logger give out the content of the variables.
Torsten

Kühne + Nagel (AG & Co.) KG, Geschäftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persönlich haftende Gesellschaft: Kühne & Nagel A.G., Sitz: Contern/Luxemburg, Geschäftsführender Verwaltungsrat: Klaus-Michael Kühne

Von: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von TONY JOHN - ERS, HCL Tech
Gesendet: Mittwoch, 25. November 2009 12:53
An: Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Set Due Date - Child Tickets

Hi Torsten,

I tried this Scrip but it isn’t working

my $duedate = RT::Date->new($RT::SystemUser);

my $bus_hours_duetime = 24;

$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

$self->TicketObj->SetDue($duedate->ISO);

my $DepOnBy = $self->TicketObj->DependedOnBy;

$RT::Logger->debug(“BaseObj called”);

while (my $dep = $DepOnBy->Next) {

my $systicket = RT::Ticket->new($RT::SystemUser);

$systicket->Load($dep->BaseObj->Id);

my $Members = $systicket->Members;

while(my $l = $Members->Next ) {

$l->BaseObj->SetDue($duedate->ISO);

}

$RT::Logger->debug(“BaseObj called”);

}

return 1;

Regards,

Tony

From: Torsten Brumm [mailto:torsten.brumm@googlemail.com]
Sent: Wednesday, November 25, 2009 5:02 PM
To: TONY JOHN - ERS, HCL Tech
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Set Due Date - Child Tickets

Hi Tony,

i think the problem is my $link = $self->TicketObj->DependedOnBy->Next; which gives you back all possible DependedOnBy Tickets, also if you have more. I tried something similar last week.

Attached a piece of code to find all deponby tickets and update the deponbys with something.

my $DepOnBy = $self->TicketObj->DependedOnBy;
my $dep;
my $l;
while( $dep = $DepOnBy->Next ) {
next unless( $dep->BaseURI->IsLocal );
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while( $l = $Members->Next ) {
next unless( $l->TargetURI->IsLocal );
next unless( $l->BaseObj->Queue =~ /^(?:1043|612|613)$/ );
$self->TicketObj->AddLink(Type=>‘MemberOf’,Base=>$l->BaseObj->Id);
}
}
return 1;

In my case i added to all deponby tickets a new member, you can replace this with your setdue part i think,

Torsten

Hi Torsten,
Yes indeed it seems to be bad day for coding :slight_smile:

The scrip didn’t enter the while loop itself.No debug statements appeared in the log file.

Log File:
[Wed Nov 25 13:05:46 2009] [debug]: Committing scrip #132 on txn #115304 of ticket #2046 (/usr/lib/perl5/vendor_perl/5.10.0/RT/Scrips_Overlay.pm:190)

Regards,
TonyFrom: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID [mailto:torsten.brumm@Kuehne-Nagel.com]
Sent: Wednesday, November 25, 2009 6:30 PM
To: Tony John - ERS, HCL Tech; Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Subject: AW: [rt-users] Set Due Date - Child Tickets

Argh, it is not a good day for coding today…

This should be the correct one:

my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);

Update DueTime for Master Ticket

$self->TicketObj->SetDue($duedate->ISO);

Find all DependedOnBy of Master Ticket

my $DepOnBy = $self->TicketObj->DependedOnBy;

while (my $dep = $DepOnBy->Next) {
$RT::Logger->debug(“DepOnTickets: $dep->BaseObj->Id”);
# OK, from this point we have all Tickets DependedOnBy Master Ticket
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
# Now we have the ID of each DependedOnBy Ticket
$systicket->SetDue($duedate->ISO);
$RT::Logger->debug(“BaseObj called 2”);
}
return 1;

Von: Tony John - ERS, HCL Tech [mailto:tonyjohn@hcl.in]
Gesendet: Mittwoch, 25. November 2009 13:23
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID; Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Betreff: RE: [rt-users] Set Due Date - Child Tickets
Hi Torsten,

my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
my $DepOnBy = $self->TicketObj->DependedOnBy;
$RT::Logger->debug(“BaseObj called 1”);
while (my $dep = $DepOnBy->Next) {
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;

while(my $l = $Members->Next ) {
$l->TicketObj->SetDue($duedate->ISO);
}
$RT::Logger->debug(“BaseObj called 2”);
}
return 1;

This scrip also couldn’t set Due Date for the Child Ticket.Only the first RT::Logger was seen in the RT logfile.I think its not entering the loop “while (my $dep = $DepOnBy->Next)”

Any help?

Regards,
Tony
From: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID [mailto:torsten.brumm@Kuehne-Nagel.com]
Sent: Wednesday, November 25, 2009 5:36 PM
To: TONY JOHN - ERS, HCL Tech; Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Subject: AW: [rt-users] Set Due Date - Child Tickets

Hi Tony,

i think this is the problem:

$l->BaseObj->SetDue($duedate->ISO);

should by $l->TicketObj->SetDue($duedate->ISO);

Like this:

your calculations

my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);

find depon ticket

my $DepOnBy = $self->TicketObj->DependedOnBy;
$RT::Logger->debug(“BaseObj called”);

loop through all deponbys

while (my $dep = $DepOnBy->Next) {
my $systicket = RT::Ticket->new($RT::SystemUser);

# Get ID of all deponby tickets and load from id the ticketobj
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;

from here we have all our depended on by tickets, we will set the due here

while(my $l = $Members->Next ) {
$l->TicketObj->SetDue($duedate->ISO);
}
$RT::Logger->debug(“BaseObj called”);
}
return 1;

Otherwise, let the logger give out the content of the variables.
Torsten

Kühne + Nagel (AG & Co.) KG, Geschäftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persönlich haftende Gesellschaft: Kühne & Nagel A.G., Sitz: Contern/Luxemburg, Geschäftsführender Verwaltungsrat: Klaus-Michael Kühne

Von: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von TONY JOHN - ERS, HCL Tech
Gesendet: Mittwoch, 25. November 2009 12:53
An: Torsten Brumm
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Set Due Date - Child Tickets
Hi Torsten,

I tried this Scrip but it isn’t working

my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
my $DepOnBy = $self->TicketObj->DependedOnBy;
$RT::Logger->debug(“BaseObj called”);
while (my $dep = $DepOnBy->Next) {
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while(my $l = $Members->Next ) {
$l->BaseObj->SetDue($duedate->ISO);
}
$RT::Logger->debug(“BaseObj called”);
}
return 1;

Regards,
Tony
From: Torsten Brumm [mailto:torsten.brumm@googlemail.com]
Sent: Wednesday, November 25, 2009 5:02 PM
To: TONY JOHN - ERS, HCL Tech
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Set Due Date - Child Tickets

Hi Tony,
i think the problem is my $link = $self->TicketObj->DependedOnBy->Next; which gives you back all possible DependedOnBy Tickets, also if you have more. I tried something similar last week.

Attached a piece of code to find all deponby tickets and update the deponbys with something.

my $DepOnBy = $self->TicketObj->DependedOnBy;
my $dep;
my $l;
while( $dep = $DepOnBy->Next ) {
next unless( $dep->BaseURI->IsLocal );
my $systicket = RT::Ticket->new($RT::SystemUser);
$systicket->Load($dep->BaseObj->Id);
my $Members = $systicket->Members;
while( $l = $Members->Next ) {
next unless( $l->TargetURI->IsLocal );
next unless( $l->BaseObj->Queue =~ /^(?:1043|612|613)$/ );
$self->TicketObj->AddLink(Type=>‘MemberOf’,Base=>$l->BaseObj->Id);
}
}
return 1;

In my case i added to all deponby tickets a new member, you can replace this with your setdue part i think,

Torsten
2009/11/25 TONY JOHN - ERS, HCL Tech <tonyjohn@hcl.inmailto:tonyjohn@hcl.in>
Hi ,

I’m trying to set the Due date of the child Ticket.But my scrips is giving some error.Please find below the Custom action clean up code used for the same:

my $link = $self->TicketObj->DependedOnBy->Next;
my $duedate = RT::Date->new($RT::SystemUser);
my $hours_duetime = 24;
$duedate->Set(Format=>‘unix’, Value=>$hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
$link->BaseObj->SetDue($duedate->ISO);
return 1;

Error : Log File

[Wed Nov 25 09:08:30 2009] [debug]: Committing scrip #11 on txn #114748 of ticket #1972 (/usr/lib/perl5/vendor_perl/5.10.0/RT/Scrips_Overlay.pm:190)
[Wed Nov 25 09:08:30 2009] [error]: Scrip 125 Commit failed: Can’t call method “BaseObj” on an undefined value at (eval 1531) line 8.

Any help?

Regards,
Tony

DISCLAIMER:

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.

It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in

this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.

Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of

this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have

received this email in error please delete it and notify the sender immediately. Before opening any mail and

attachments please check them for viruses and defect.

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.commailto:sales@bestpractical.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