Scrip help

To all,

I have a scrip that is supposed to modify the ticket owner to "Nobody" 

when the ticket is moved to another queue. What I have is:

Name: Mod Owner on Q chg
Condition: On Queue Change
Action: User Defined
Template: Blank
Stage: TransactionBatch

Custom Condition: none
Custom Action Prep Code:

set new Ticket Owner value

my $Ticket = $self->TicketObj;
$Ticket->SetOwner(‘Nobody’);
return 1;

Custom Action Cleanup Code: none

Actually, I also tried it with Return 1: in the prep code and the 

modifying code in the cleanup and still no go with either way. Here I
was thinking it would be a simple scrip and I can’t get it to work. I am
also executing a notification scrip for the same condition and it works.
Anyone have an idea on what’s wrong? Thanks.

Kenn
LBNL

Custom action preparation code:
return 1;

Custom action cleanup code:
$RT::Logger->debug(“trying to set owner”);
my ($code, $msg) = $self->TicketObj->SetOwner(10, ‘Force’);
$RT::Logger->debug(“set owner: $code: $msg”);

return 1;

Keep up with me and what I’m up to: http://theillien.blogspot.com

Kenneth Crocker wrote:

Mathew,

It worked great! Thanks! I figured I might need the object id as 

opposed to name. I didn’t realise I needed to do a force either. Thanks
again.

Kenn
LBNLOn 10/18/2007 10:48 AM, Mathew Snyder wrote:

Custom action preparation code:
return 1;

Custom action cleanup code:
$RT::Logger->debug(“trying to set owner”);
my ($code, $msg) = $self->TicketObj->SetOwner(10, ‘Force’);
$RT::Logger->debug(“set owner: $code: $msg”);

return 1;

Keep up with me and what I’m up to: http://theillien.blogspot.com

Kenneth Crocker wrote:

To all,

I have a scrip that is supposed to modify the ticket owner to

“Nobody” when the ticket is moved to another queue. What I have is:

Name: Mod Owner on Q chg
Condition: On Queue Change
Action: User Defined
Template: Blank
Stage: TransactionBatch

Custom Condition: none
Custom Action Prep Code:

set new Ticket Owner value

my $Ticket = $self->TicketObj;
$Ticket->SetOwner(‘Nobody’);
return 1;

Custom Action Cleanup Code: none

Actually, I also tried it with Return 1: in the prep code and the

modifying code in the cleanup and still no go with either way. Here I
was thinking it would be a simple scrip and I can’t get it to work. I am
also executing a notification scrip for the same condition and it works.
Anyone have an idea on what’s wrong? Thanks.

Kenn
LBNL


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

Hello all,

Started using RT today, and am trying to write my own scrip. As per http://requesttracker.wikia.com/wiki/WriteCustomAction

I’ve tried copying the example using this:

(current iteration)

MyScrip.pm (in the actions folder)

package RT::Action::MyScrip;

use strict;
use warnings;

sub Prepare {
  my $self = shift;

  return 1;
}

sub Commit {
  my $self = shift;

  return 1;
}

1;

I have the scrip and action setup but my log is throwing this:

[log]
[Tue May 24 14:08:35 2011] [debug]: Found 1 scrips for TransactionCreate stage with applicable type(s) Create for txn #248 on ticket #41 (/usr/local/lib/perl5/site_perl/5.10.1/RT/Scrips_Overlay.pm:377)
[Tue May 24 14:08:35 2011] [error]: Scrip Prepare 1 died. - Require of RT::Action:: MyScrip failed.
Attempt to reload RT/Action/MyScrip.pm aborted.
Compilation failed in require at (eval 5748) line 3.

Stack:
[(eval 5748):3]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Scrip_Overlay.pm:443]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Scrips_Overlay.pm:241]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Transaction_Overlay.pm:169]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Record.pm:1457]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Ticket_Overlay.pm:660]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Interface/Email.pm:1466]
[/usr/local/share/rt38/html/REST/1.0/NoAuth/mail-gateway:61]

Stack:
[/usr/local/lib/perl5/site_perl/5.10.1/RT/ScripAction_Overlay.pm:173]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Scrip_Overlay.pm:443]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Scrips_Overlay.pm:241]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Transaction_Overlay.pm:169]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Record.pm:1457]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Ticket_Overlay.pm:660]
[/usr/local/lib/perl5/site_perl/5.10.1/RT/Interface/Email.pm:1466]
[/usr/local/share/rt38/html/REST/1.0/NoAuth/mail-gateway:61] (/usr/local/lib/perl5/site_perl/5.10.1/RT/Scrip_Overlay.pm:451)
[Tue May 24 14:08:35 2011] [debug]: Skipping Scrip #1 because it didn’t Prepare (/usr/local/lib/perl5/site_perl/5.10.1/RT/Scrips_Overlay.pm:244)

[/log]

Can’t figure out the problem since I am working from the example.
Any help/advice/example to copy from?

Barry Carlyon
Freelance Web Developer
Freelance Lighting/AV Engineer

mobile: 07729 048 443
skype: barrycarlyon
email: barry@barrycarlyon.co.uk
msn: barry@barrycarlyon.co.uk

To follow up.

I have no idea what I just changed but it is working now.
As in I don’t get a fail log type entry now…

confused

Barry Carlyon
Freelance Web Developer
Freelance Lighting/AV Engineer

mobile: 07729 048 443
skype: barrycarlyon
email: barry@barrycarlyon.co.uk
msn: barry@barrycarlyon.co.uk

Seems that my RT is compiling scrips and apache restart rather than at Run time…

Now I’m even more confused as this is not mentioned in the wiki…

Barry Carlyon
Freelance Web Developer
Freelance Lighting/AV Engineer

mobile: 07729 048 443
skype: barrycarlyon
email: barry@barrycarlyon.co.uk
msn: barry@barrycarlyon.co.ukOn 24 May 2011, at 15:37, Barry Carlyon wrote:

To follow up.

I have no idea what I just changed but it is working now.
As in I don’t get a fail log type entry now…

confused


Barry Carlyon
Freelance Web Developer
Freelance Lighting/AV Engineer

http://barrycarlyon.co.uk

mobile: 07729 048 443
skype: barrycarlyon
email: barry@barrycarlyon.co.uk
msn: barry@barrycarlyon.co.uk

Hi,

When you work on a scrip in a file, you either use DevelMode or
restart web server every time you change the file. DevelMode helps in
most cases, but not always. If you see some error you don’t understand
and DevelMode is enabled, try server restart, error may be different
after that and make sense.On Tue, May 24, 2011 at 6:45 PM, Barry Carlyon barry@barrycarlyon.co.uk wrote:

Seems that my RT is compiling scrips and apache restart rather than at Run time…

Now I’m even more confused as this is not mentioned in the wiki…


Barry Carlyon
Freelance Web Developer
Freelance Lighting/AV Engineer

http://barrycarlyon.co.uk

mobile: 07729 048 443
skype: barrycarlyon
email: barry@barrycarlyon.co.uk
msn: barry@barrycarlyon.co.uk

On 24 May 2011, at 15:37, Barry Carlyon wrote:

To follow up.

I have no idea what I just changed but it is working now.
As in I don’t get a fail log type entry now…

confused


Barry Carlyon
Freelance Web Developer
Freelance Lighting/AV Engineer

http://barrycarlyon.co.uk

mobile: 07729 048 443
skype: barrycarlyon
email: barry@barrycarlyon.co.uk
msn: barry@barrycarlyon.co.uk

Best regards, Ruslan.