[rt-users] Set Owner by Requestor Organization?

Jeff Blaine jblaine at kickflop.net
Wed Sep 8 11:12:23 EDT 2010



On 9/8/2010 9:24 AM, Steven Platt wrote:
> Hi,
>
> I'm trying to achieve this using a chopped version of
> http://wiki.bestpractical.com/view/SetOwnerAndQueueBySubject 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.



More information about the rt-users mailing list