On 2/13/2007 3:09 PM, anthony wrote:

Where are you doing this the webui?

The following worked for me in 3.6.3 (Note: this is NOT through the WebUI -- not sure if it will help you or not):

sub IsApplicable
{
        my($self) = shift;

        my($CFNAME) = 'Severity';

        my($q) = $self->TicketObj->QueueObj;
        my($cf) = new RT::CustomField $q->CurrentUser;

        $cf->LoadByNameAndQueue(Name => $CFNAME, Queue => $q->id);
        $cf->LoadByNameAndQueue(Name => $CFNAME, Queue => 0) unless $cf->id;
        unless ($cf->id) {
$RT::Logger->warning("Custom field '$CFNAME' isn't global or defined for queue '" . $q->Name . "'");
                return undef;
        }

        return ! $self->TicketObj->FirstCustomFieldValue($cf->id);
}


and:


sub Prepare
{
        my($self) = shift;

        my($CFNAME) = 'Severity';
        my($CFDEFVAL) = 'Medium';

        my($q) = $self->TicketObj->QueueObj;
        my($cf) = new RT::CustomField $q->CurrentUser;

        $cf->LoadByNameAndQueue(Name => $CFNAME, Queue => $q->id);
        $cf->LoadByNameAndQueue(Name => $CFNAME, Queue => 0) unless $cf->id;

        my($rc, $msg) = $self->TicketObj->AddCustomFieldValue(Field => $CFNAME,
                                                                                   
                               Value => $CFDEFVAL,
                                                                                   
                               RecordTransaction => 1);

        unless ($rc) {
                $RT::Logger->warning("Could not set '$CFNAME' to '$CFDEFVAL': 
$msg");
                return undef;
        }

        return 1;
}



--
Regards,


joe
Joe Casadonte
[EMAIL PROTECTED]
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com

Reply via email to