[rt-users] SetOwner chemistry

Jesse Vincent jesse at bestpractical.com
Mon Apr 30 10:41:57 EDT 2007

On Apr 30, 2007, at 10:23 AM, Konstantin Naryzhniy wrote:

> Hello!
> RT 3.6.1
> Could anyone predict the results of setting ticket's owner manually  
> through
> simple SQL query:
> update Tickets set Owner = 123456 where id = 654321;  ?
> I know that there are several tables updated in SetOwner method and  
> I am
> interested what consequences such  "brutal" workaround may cause.
> So far I've tested this query and it looks fine for ticket updating  
> and
> resolving.
> If using this query multiple time eventually can trigger RT failure I
> wouldn't want to use it.

Using it even once will hurt you, alas.

> Also, I would appreciate it very much if you could provide me with  
> the list
> of tables updated during SetOwner.
> The reason I don't favor using SetOwner is that I do not know how  
> to=) I'm
> trying to write a custom auto ticket assingment perl-module that  
> should be
> put in crontab and I've just no idea how to utilize RT lib in there.

There should be some samples on the wiki to help you out, but this  
(untested) code may do what you mean:

use warnings;
use strict;
use lib '/opt/rt3/lib';
use RT;
use RT::Ticket;
use RT::User;

my $user = RT::User->new($RT::SystemUser);
$user->LoadByCols(Name => 'root');
my $ticket = RT::Ticket->new($RT::SystemUser);
my ($val,$msg) = $ticket->SetOwner($user->id);

print $msg;

> Seriosly, I'm no programmer))
> Any help and advice appreciated,
> Sincerely,
> Stan
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20070430/9f60b90d/attachment.sig>

More information about the rt-users mailing list