Get Asset Owner from DB

Hi,

Can anyone help me with a information ? How I can get the owner of an asset from DB ? or to be more specific, which is the best way to get the owner of an asset ?

I currently use MySQL DB with RT v4.4.4

Thanks

You want to get this info from RT using some kind of script on the RT server? If you give a more clear idea or what you’re trying to do we can help more

I want to get this info from Database with SQL Query

Using SQL I don’t know offhand how to do that, but if you’re on the RT server then the Perl RT API is available to you. So you could write a Perl script that loads the RT::Asset object and use the methods available to the RT::Asset object:

https://docs.bestpractical.com/rt/4.4.4/RT/Asset.html

Ok, I will try using a perl script. Thanks for your help @knation

You can make a .pl script that starts with this:

#!/usr/bin/perl

use strict;
use warnings;

use lib qw(/opt/rt4/local/lib /opt/rt4/lib);

use RT::Interface::CLI qw(Init);
my %opt;
Init( \%opt, 'debug', 'help|h' );


my $asset = RT::Asset->new(RT->SystemUser);

# Load your asset and do something with it!
1 Like