Scrip Action

I’m attempting a very basic Scrip, as follows:

Description :Set Priority

Condition :On Create

Action :User Defined

Custom action preparation code:
$RT::Logger->info($Transaction->CreatorObj->EmailAddress);
($Transaction->CreatorObj->EmailAddress =~ /rbellamy@pteradigm.com/i)
? 1 : 0;

Custom action cleanup code:
$Ticket->SetPriority(“50”);

Template :Global template: Blank

And I receive the following error in the error log (note that the call
to the $RT::Logger seems to be ignored):

Nov 10 00:25:42 support RT: RT::Scrip=HASH(0x9bcb548): Couldn’t prepare
User Defined (/opt/rt3/lib/RT/Scrip_Overlay.pm:338)

This seems to indicate that it’s my custom action preparation code
that’s killing the scrip. I can’t seem to find anything that doesn’t
throw the error.

Any help would be greatly appreciated.

G. Richard Bellamy
Enterprise Solution Architect
Pteradigm - Evolutionary
mailto:rbellamy@pteradigm.com
V:707-869-3665

Hello. Richard.
G. Richard Bellamy wrote:

I’m attempting a very basic Scrip, as follows:

===============================
Description :Set Priority

Condition :On Create

Action :User Defined

Custom action preparation code:
$RT::Logger->info($Transaction->CreatorObj->EmailAddress);
($Transaction->CreatorObj->EmailAddress =~ /rbellamy@pteradigm.com/i)
? 1 : 0;
You have to use:
$self->TransactionObj to get Current Transaction object, also:
$self->TicketObj
$self->ScripObj
$self->TemplateObj
$self->Argument
$self->Type

Custom action cleanup code:
$Ticket->SetPriority(“50”);

Template :Global template: Blank

And I receive the following error in the error log (note that the call
to the $RT::Logger seems to be ignored):

===============================
Nov 10 00:25:42 support RT: RT::Scrip=HASH(0x9bcb548): Couldn’t prepare
User Defined (/opt/rt3/lib/RT/Scrip_Overlay.pm:338)

Encrease log level or may be other records was piped to another log file
with syslog. I use RT’s logtofile, it’s better to track down such things.

This seems to indicate that it’s my custom action preparation code
that’s killing the scrip. I can’t seem to find anything that doesn’t
throw the error.

Any help would be greatly appreciated.
Best regards. Ruslan.

-----Original Message-----
From: Ruslan U. Zakirov [mailto:cubic@acronis.ru]
Sent: Monday, November 10, 2003 1:03 AM
To: G. Richard Bellamy
Cc: rt-devel@fsck.com
Subject: Re: [rt-devel] Scrip Action

You have to use:
$self->TransactionObj to get Current Transaction object, also:
$self->TicketObj
$self->ScripObj
$self->TemplateObj
$self->Argument
$self->Type

Ruslan, et. al.,

I tried that, and I’m still getting the “Couldn’t prepare User Defined”
error. Thanks for the input though!

Any other suggestions, anyone?

G. Richard Bellamy ???:

-----Original Message-----
From: Ruslan U. Zakirov [mailto:cubic@acronis.ru]
Sent: Monday, November 10, 2003 1:03 AM
To: G. Richard Bellamy
Cc: rt-devel@fsck.com
Subject: Re: [rt-devel] Scrip Action

You have to use:
$self->TransactionObj to get Current Transaction object, also:
$self->TicketObj
$self->ScripObj
$self->TemplateObj
$self->Argument
$self->Type

Ruslan, et. al.,

I tried that, and I’m still getting the “Couldn’t prepare User Defined”
error. Thanks for the input though!
If you don’t have “[error] Scrip #id Prepare failed: …” then you
action prep code syntax is ok.

Custom action preparation code is not an additional condition. RT
suppose that this block return ‘false’ only when error take place.
So when your scrip return 0 then RT write such error message in logs.
I understand that spliting your code in two parts looks better, but in
this case your should ignore this error or in other case change
preparation code to ‘return 1;’ and move ‘if’ condition to commit block.

I hope you’ve understood my bad English. :wink:
Good luck. Ruslan.