Set Owner by Requestor Organization?

Hi,

I’m trying to achieve this using a chopped version of
SetOwnerAndQueueBySubject - Request Tracker Wiki and some
wisdom clipped from elsewhere in the wiki (some of the scrips pages, I
forget exactly which), and here is what I have:

Condition: On Create
Action: User defined
Template: Global template:blank
Stage: TransactionCreate

Custom prep code

$t_org = $self->TransactionObj->CreatorObj->__Value(‘Organization’); ##
also tried $t_org = $self->TransactionObj->CreatorObj->Organization;
if ( $t_org !~ /(VRD|GEZI)/i ) { return 0; }
else { return 1; }

Custom cleanup code

$t_org = $self->TransactionObj->CreatorObj->__Value(‘Organization’); ##
also tried $t_org = $self->TransactionObj->CreatorObj->Organization;
if ( $t_org =~ /VRD/i ) { $newowner = “owner.a”; }
if ( $t_org =~ /GEZI/i ) { $newowner = “owner.b”; }
my $T_Obj = $self->TicketObj;

$RT::Logger->info(“Auto assign ticket #”. $T_Obj->id ." to user #".
$newowner );
my ($status, $msg) = $self->TicketObj->SetOwner( $newowner );
unless( $status ) {
$RT::Logger->error( “Impossible to assign the ticket to $newowner:
$msg” );
return undef;
}
return 1;

…but it appears to have no effect on the ticket whatsoever. Can anyone
point me in the right direction?

Also, I’m testing this by generating dummy tickets on our production
(and only) instance of RT. This can’t be the recommended method of scrip
testing, can it!!

TIA

Steve
HPA Bioinformatics
UK
The information contained in the EMail and any attachments is
confidential and intended solely and for the attention and use of
the named addressee(s). It may not be disclosed to any other person
without the express authority of the HPA, or the intended
recipient, or both. If you are not the intended recipient, you must
not disclose, copy, distribute or retain this message or any part
of it. This footnote also confirms that this EMail has been swept
for computer viruses, but please re-sweep any attachments before
opening or saving. HTTP://www.HPA.org.uk

Hi,

I’m trying to achieve this using a chopped version of
SetOwnerAndQueueBySubject - Request Tracker Wiki and some
wisdom clipped from elsewhere in the wiki (some of the scrips pages, I
forget exactly which), and here is what I have:

Condition: On Create
Action: User defined
Template: Global template:blank
Stage: TransactionCreate

Custom prep code

$t_org = $self->TransactionObj->CreatorObj->__Value(‘Organization’); ##
also tried $t_org = $self->TransactionObj->CreatorObj->Organization;
if ( $t_org !~ /(VRD|GEZI)/i ) { return 0; }
else { return 1; }

Custom cleanup code

$t_org = $self->TransactionObj->CreatorObj->__Value(‘Organization’); ##
also tried $t_org = $self->TransactionObj->CreatorObj->Organization;
if ( $t_org =~ /VRD/i ) { $newowner = “owner.a”; }
if ( $t_org =~ /GEZI/i ) { $newowner = “owner.b”; }
my $T_Obj = $self->TicketObj;

$RT::Logger->info(“Auto assign ticket #”. $T_Obj->id ." to user #".
$newowner );
my ($status, $msg) = $self->TicketObj->SetOwner( $newowner );
unless( $status ) {
$RT::Logger->error( “Impossible to assign the ticket to $newowner:
$msg” );
return undef;
}
return 1;

…but it appears to have no effect on the ticket whatsoever. Can anyone
point me in the right direction?

Are you seeing any logged messages from your cleanup code?

I’d just start by adding a lot more $RT::Logger calls for
debugging info.

Log what $t_org gets set to in the prep code, etc.

Steven,

I don’t know if this idea will help, but we use a Custom Field we call
“CFO-Org” and when someone sends in an email, CommandByMail allows us to set
that field and we use that value against an array of possible values in a
scrip to set the owner for the ticket. It’s a variation of using a value in
the Subject field, except that it’s a Custom Field value set by using
CommandByMail. Hope this helps.

Kenn
LBNLOn Wed, Sep 8, 2010 at 6:24 AM, Steven Platt Steven.Platt@hpa.org.ukwrote:

Hi,

I’m trying to achieve this using a chopped version of
SetOwnerAndQueueBySubject - Request Tracker Wiki and some
wisdom clipped from elsewhere in the wiki (some of the scrips pages, I
forget exactly which), and here is what I have:

Condition: On Create
Action: User defined
Template: Global template:blank
Stage: TransactionCreate

Custom prep code

$t_org = $self->TransactionObj->CreatorObj->__Value(‘Organization’); ##
also tried $t_org = $self->TransactionObj->CreatorObj->Organization;
if ( $t_org !~ /(VRD|GEZI)/i ) { return 0; }
else { return 1; }

Custom cleanup code

$t_org = $self->TransactionObj->CreatorObj->__Value(‘Organization’); ##
also tried $t_org = $self->TransactionObj->CreatorObj->Organization;
if ( $t_org =~ /VRD/i ) { $newowner = “owner.a”; }
if ( $t_org =~ /GEZI/i ) { $newowner = “owner.b”; }
my $T_Obj = $self->TicketObj;

$RT::Logger->info(“Auto assign ticket #”. $T_Obj->id ." to user #".
$newowner );
my ($status, $msg) = $self->TicketObj->SetOwner( $newowner );
unless( $status ) {
$RT::Logger->error( “Impossible to assign the ticket to $newowner:
$msg” );
return undef;
}
return 1;

…but it appears to have no effect on the ticket whatsoever. Can anyone
point me in the right direction?

Also, I’m testing this by generating dummy tickets on our production
(and only) instance of RT. This can’t be the recommended method of scrip
testing, can it!!

TIA

Steve
HPA Bioinformatics
UK


The information contained in the EMail and any attachments is
confidential and intended solely and for the attention and use of
the named addressee(s). It may not be disclosed to any other person
without the express authority of the HPA, or the intended
recipient, or both. If you are not the intended recipient, you must
not disclose, copy, distribute or retain this message or any part
of it. This footnote also confirms that this EMail has been swept
for computer viruses, but please re-sweep any attachments before
opening or saving. HTTP://www.HPA.org.uk


RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!

Yes, enabling file logging and some extra logger calls did help sort it
out. Thanks Jeff.

It turns out that I forgot the ‘my’ declaration on $newowner in the
cleanup code. Also, both…

$self->TransactionObj->CreatorObj->__Value(‘Organization’);
and
$self->TransactionObj->CreatorObj->Organization;

…return the same value. Useful.

Can anyone point me towards any documentation for scrips (other than the
[very useful] wiki)?

Thanks

SteveFrom: Jeff Blaine [mailto:jblaine@kickflop.net]
Sent: 08 September 2010 16:12
To: Steven Platt
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Set Owner by Requestor Organization?

Hi,

I’m trying to achieve this using a chopped version of
SetOwnerAndQueueBySubject - Request Tracker Wiki and some
wisdom clipped from elsewhere in the wiki (some of the scrips pages, I
forget exactly which), and here is what I have:

Condition: On Create
Action: User defined
Template: Global template:blank
Stage: TransactionCreate

Custom prep code

$t_org = $self->TransactionObj->CreatorObj->__Value(‘Organization’);
also tried $t_org = $self->TransactionObj->CreatorObj->Organization;
if ( $t_org !~ /(VRD|GEZI)/i ) { return 0; }
else { return 1; }

Custom cleanup code

$t_org = $self->TransactionObj->CreatorObj->__Value(‘Organization’);
also tried $t_org = $self->TransactionObj->CreatorObj->Organization;
if ( $t_org =~ /VRD/i ) { $newowner = “owner.a”; }
if ( $t_org =~ /GEZI/i ) { $newowner = “owner.b”; }
my $T_Obj = $self->TicketObj;

$RT::Logger->info(“Auto assign ticket #”. $T_Obj->id ." to user #".
$newowner );
my ($status, $msg) = $self->TicketObj->SetOwner( $newowner );
unless( $status ) {
$RT::Logger->error( “Impossible to assign the ticket to
$newowner:
$msg” );
return undef;
}
return 1;

…but it appears to have no effect on the ticket whatsoever. Can
anyone
point me in the right direction?

Are you seeing any logged messages from your cleanup code?

I’d just start by adding a lot more $RT::Logger calls for
debugging info.

Log what $t_org gets set to in the prep code, etc.
The information contained in the EMail and any attachments is
confidential and intended solely and for the attention and use of
the named addressee(s). It may not be disclosed to any other person
without the express authority of the HPA, or the intended
recipient, or both. If you are not the intended recipient, you must
not disclose, copy, distribute or retain this message or any part
of it. This footnote also confirms that this EMail has been swept
for computer viruses, but please re-sweep any attachments before
opening or saving. HTTP://www.HPA.org.uk