Re: [rt-users] Scrip question and how to debug?

2008-03-17 Thread John Arends
$Owner->Name was what I was looking for. I'll have to post my scrip so 
other people can figure out what is going on.

John Arends wrote:
> Vivek:
> 
> Looking at log output made me realize that $Owner does not contain the 
> name of the owner. Where is the actual owner name stored as a string? I 
> want to compare that string to Nobody. This seems like it should be 
> fairly simple but I don't understand enough about how RT works 
> internally to figure that out.
> 
> my $admincclist = $self->TicketObj->AdminCc;
> 
>   my $Owner = $self->TicketObj->OwnerObj;
> 
> if ( $Owner->Id ne "Nobody"){
>   $admincclist->AddMember($Owner->Id);
> }
> 
> 
> 
>
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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


Re: [rt-users] Scrip question and how to debug?

2008-03-17 Thread Ham MI-ID, Torsten Brumm
You compare owner-id with nobody string?!? Nobody id is 10 compare owner id 
with nobody id could work.

Torsten


Kühne + Nagel (AG & Co.) KG, Geschäftsleitung: Hans-Georg Brinkmann (Vors.), 
Uwe Bielang (Stellv.), Bruno Mang, Alfred Manke, Thorsten Meincke, 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


-Original Message-
From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
To: Vivek Khera <[EMAIL PROTECTED]>
CC: RT Users 
Sent: Mon Mar 17 16:19:10 2008
Subject: Re: [rt-users] Scrip question and how to debug?

Vivek:

Looking at log output made me realize that $Owner does not contain the 
name of the owner. Where is the actual owner name stored as a string? I 
want to compare that string to Nobody. This seems like it should be 
fairly simple but I don't understand enough about how RT works 
internally to figure that out.

my $admincclist = $self->TicketObj->AdminCc;

  my $Owner = $self->TicketObj->OwnerObj;

if ( $Owner->Id ne "Nobody"){
  $admincclist->AddMember($Owner->Id);
}




Vivek Khera wrote:
> On Mar 14, 2008, at 2:25 PM, John Arends wrote:
> 
>> Second, is there a good way to debug scrips? I feel like I'm just
>> feeling around in the dark and don't know how to tell if they're  
>> really
>> working, or what the contents of variables are, etc. If I was writing
> 
> sprinkle your scrip with lines like this:
> 
>$RT::Logger->error("Got a create transacation...");
> 
> and look in your RT logfile.
> 






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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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

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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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

Re: [rt-users] Scrip question and how to debug?

2008-03-17 Thread John Arends
Vivek:

Looking at log output made me realize that $Owner does not contain the 
name of the owner. Where is the actual owner name stored as a string? I 
want to compare that string to Nobody. This seems like it should be 
fairly simple but I don't understand enough about how RT works 
internally to figure that out.

my $admincclist = $self->TicketObj->AdminCc;

  my $Owner = $self->TicketObj->OwnerObj;

if ( $Owner->Id ne "Nobody"){
  $admincclist->AddMember($Owner->Id);
}




Vivek Khera wrote:
> On Mar 14, 2008, at 2:25 PM, John Arends wrote:
> 
>> Second, is there a good way to debug scrips? I feel like I'm just
>> feeling around in the dark and don't know how to tell if they're  
>> really
>> working, or what the contents of variables are, etc. If I was writing
> 
> sprinkle your scrip with lines like this:
> 
>$RT::Logger->error("Got a create transacation...");
> 
> and look in your RT logfile.
> 






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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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


Re: [rt-users] Scrip question and how to debug?

2008-03-14 Thread Vivek Khera
On Mar 14, 2008, at 2:25 PM, John Arends wrote:

> Second, is there a good way to debug scrips? I feel like I'm just
> feeling around in the dark and don't know how to tell if they're  
> really
> working, or what the contents of variables are, etc. If I was writing

sprinkle your scrip with lines like this:

   $RT::Logger->error("Got a create transacation...");

and look in your RT logfile.

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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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


[rt-users] Scrip question and how to debug?

2008-03-14 Thread John Arends
I have a scrip that should be adding the owner as an AdminCC on ticket 
create. It works fine. However, if a ticket is created with no owner 
set, it sets an AdminCC as Nobody, which is annoying.

I threw an if statement in there to try to handle it, but I am doing 
something wrong.

  my $admincclist = $self->TicketObj->AdminCc;

  my $Owner = $self->TicketObj->OwnerObj;

if ( $Owner ne "Nobody"){
  $admincclist->AddMember($Owner->Id);
}

$Owner must not really be the string nobody, because Nobody is still 
being added as an AdminCC. Any suggestions on what I should be looking 
for instead?

Second, is there a good way to debug scrips? I feel like I'm just 
feeling around in the dark and don't know how to tell if they're really 
working, or what the contents of variables are, etc. If I was writing 
straight perl code I could have it print the content of $Owner so I 
could see what was in there.

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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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