[rt-users] Question on use of Category in a scrip

Ken Crocker kfcrocker at lbl.gov
Wed Jun 10 11:31:40 EDT 2009


Remi,

    HA! you're right. That's a bit convoluted but, what the hey. I 
"gotta do what I gotta do". This will be helpful in validating CF 
entries for certain Queues. Thanks.

Kenn
LBNL

On 6/10/2009 8:12 AM, Rémi wrote:
> Hi Ken,
>
> here is the code I use to do what you want (quite painful like Jesse 
> says ...)
>
> my $CustomFieldObj = RT::CustomField->new($_[0]->CurrentUser);
> $CustomFieldObj->LoadById($field);
> my $CFVs = $CustomFieldObj->Values;
> while ($CFVs and my $value = $CFVs->Next ) {
>        if ($value->Name eq $_[0]->FirstCustomFieldValue($field)){
>                    return $value->Category;
>         }
> }
>
> ($_[0] is a the Ticket object and $field is the CF id)
>
>
> Rémi
>
>
> 2009/6/9 Ken Crocker <kfcrocker at lbl.gov <mailto:kfcrocker at lbl.gov>>
>
>     Jesse,
>
>
>         Painful?? Please explain. I'd love to hear it.
>
>     Kenn
>     LBNL
>
>
>     On 6/9/2009 11:56 AM, Jesse Vincent wrote:
>>     On Tue  9.Jun'09 at 11:26:08 -0700, Ken Crocker wrote:
>>       
>>>     Jesse,
>>>
>>>         I was thinking that that particular command gave me the Custom Field value
>>>     only. I don't see where the "category" value for that CF can be determined from
>>>     that code.
>>>         
>>     Indeed. I misread your question.  Category is an attribute of the
>>     CustomFieldValue, itself.   Getting at it will require some more work
>>     and will be a bit painful
>>
>>       
>
>     _______________________________________________
>     http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
>     Community help: http://wiki.bestpractical.com
>     Commercial support: sales at bestpractical.com
>     <mailto: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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090610/537d24cd/attachment.htm>


More information about the rt-users mailing list