<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Le 10/04/2015 13:06, Carl van
Litsenborgh a écrit :<br>
</div>
<blockquote
cite="mid:E2C4CDCEC3D3BE409AF96C801806A5B71ECC2F44@zacnmbx02.za.saabgroup.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">I have a standard installation of RT4 with
the extension RT::Extension:Assets added.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I wrote a perl script (based on the many
examples on the RT WIKI contributions pages) to scan through
all open tickets reporting (in HTML) certain key performance
indicators for me.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I would like to extend this perl script to
ALSO scan through all “assets” in my RT database and to report
on the content of a certain asset custom field (call it
Asset_Status).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have searched the mailing lists and
internet for some guidance, but found none.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Can someone please help me (or guide me)
with a perl code snippet showing the basics of how to loop (in
perl API) through all assets in RT, and to extract the
information (text field) of s specific custom field assigned
to all assets to get me started.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<br>
</div>
</blockquote>
<br>
something like:<br>
<br>
my $Catalog = RT::Catalog->new( RT->SystemUser );<br>
$Catalog->Load('Informatique');<br>
<br>
my $Assets = RT::Assets->new( RT->SystemUser );<br>
$Assets->LimitCatalog(VALUE => $Catalog->id);<br>
<br>
my $CustomField = RT::CustomField->new( RT->SystemUser );<br>
$CustomField->LoadByName( Name => 'Marque', LookupType =>
'RT::Catalog-RT::Asset' );<br>
$Assets->LimitCustomField( CUSTOMFIELD => $CustomField->id,
VALUE => 'CANON' );<br>
<br>
print "Found: ".$Assets->Count." asset(s)\n";<br>
<br>
while (my $Asset = $Assets->Next) {<br>
print "Found asset number: ".$Asset->id."\n";<br>
}<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
Easter-eggs Spécialiste GNU/Linux
44-46 rue de l'Ouest - 75014 Paris - France - Métro Gaité
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
<a class="moz-txt-link-freetext" href="mailto:elacour@easter-eggs.com">mailto:elacour@easter-eggs.com</a> - <a class="moz-txt-link-freetext" href="http://www.easter-eggs.com">http://www.easter-eggs.com</a>
</pre>
</body>
</html>