<div dir="ltr"><div>I found how to do it<br><br></div>For guys wondering how I did it, look the following example :<br>sub create_step_to_reproduce_cf<br>{<br> my $cf_name = 'Step ro reproduce';<br><br> my $cf = RT::CustomField->new($RT::SystemUser);<br>
my ($cf_exist, $cf_res_mesg) = $cf->LoadByName(Name=>$cf_name);<br><br> if (!$cf_exist)<br> {<br> $cf->Create(Name => $cf_name,<br> Queue => $_[0],<br> Type => 'FreeformMultiple',<br>
Disabled => 0,<br> Pattern => '(?#Mandatory).',<br> LookupType => 'Ticket',<br> Description => 'To define the step to reproduce the issue',<br>
Values => [ ]);<br><br> print "Custom field '".$cf->Name()."' creee\n";<br><br> foreach my $queue_name (@_)<br> {<br> my $queue = RT::Queue->new($RT::SystemUser);<br>
$queue->Load($queue_name);<br><br> my $ocf = RT::ObjectCustomField->new($RT::SystemUser);<br> $ocf->Create(ObjectId => $queue->Id, CustomField =>$cf->id);<br> }<br>
}<br> else<br> {<br> print "Custom field '".$cf->Name()."' existe deja\n";<br> }<br>}<br><br>create_step_to_reproduce_cf('Support','Presales','Delivery','R&D');<br>
<br></div><div class="gmail_extra"><br clear="all"><div><h4 style="font-weight:normal"><span>Kind regards </span>/ Cordialement<br><br><b>Alexandre Leprevost</b><br></h4>
Project Engineer / Delivery Team<p>
<img src="http://www.efficientip.com/templates/efficientip/images/efficientip_logo.png" height="48" width="173"><br>
</p><h6>
4 rue de l´Abreuvoir<br>
92 400 Courbevoie<br>
France<br>
<a href="mailto:al@efficientip.com" target="_blank">al@efficientip.com</a><br>
Tel : +33 (0)1 75 84 88 98<br>
Fax : +33 (0)9 57 88 09 40<br>
<a href="http://www.efficientip.com/" target="_blank">www.efficientip.com</a></h6></div>
<br><br><div class="gmail_quote">2013/11/8 Alexandre LEPREVOST <span dir="ltr"><<a href="mailto:al@efficientip.com" target="_blank">al@efficientip.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div>Hello There<br><br></div>I come to you with a question on "how to" to do something on RT with a script.<br><br></div>I did a script to add a customField and It's working (with one Queue attached):<br>
<br> my $cf = RT::CustomField->new($RT::SystemUser);<br> my ($cf_exist, $cf_res_mesg) = $cf->LoadByName(Name=>'Step to reproduce');<br><br> if (!$cf_exist)<br> {<br> $cf->Create(Name => $cf_name,<br>
<b><span style="color:rgb(255,0,0)">Queue => 'Support',</span></b><br> Type => 'FreeformMultiple',<br> Disabled => 0,<br>
Pattern => '(?#Mandatory).',<br>
LookupType => 'Ticket',<br> Description => 'To define the step to reproduce the issue',<br> Values => [ ]);<br> }<br><br></div>My question is about the Queue. In fact I need to attache this custom field to 3 others Queues. I've tried to find a solution to do that (with AddToObject) but I don't know how to do that. Do you have an idea ?<br>
<br></div>I don't ask a full example of course :) Just a short help on which function I need to use with an exemple :)<br><br></div>Thank you veru much for your help<br><div><div><a href="http://www.bestpractical.com/docs/rt/4.2/RT/CustomField.html#AddToObject-OBJECT" target="_blank"></a><div>
<div><div><div><div><div><h4 style="font-weight:normal"><span>Kind regards </span>/ Cordialement<br><br><b>Alexandre Leprevost</b><br></h4>
Project Engineer / Delivery Team<p>
<img src="http://www.efficientip.com/templates/efficientip/images/efficientip_logo.png" height="48" width="173"><br>
</p><h6>
4 rue de l´Abreuvoir<br>
92 400 Courbevoie<br>
France<br>
<a href="mailto:al@efficientip.com" target="_blank">al@efficientip.com</a><br>
Tel : <a href="tel:%2B33%20%280%291%2075%2084%2088%2098" value="+33175848898" target="_blank">+33 (0)1 75 84 88 98</a><br>
Fax : <a href="tel:%2B33%20%280%299%2057%2088%2009%2040" value="+33957880940" target="_blank">+33 (0)9 57 88 09 40</a><br>
<a href="http://www.efficientip.com/" target="_blank">www.efficientip.com</a></h6></div>
</div></div></div></div></div></div></div></div>
</blockquote></div><br></div>