[rt-users] Help with grabbing customfieldvalue at ticket creation

Joe Casadonte joe.casadonte at oracle.com
Fri Mar 16 11:02:03 EDT 2007


On 3/15/2007 1:40 PM, Kenneth Crocker wrote:

>     But to no avail. We need some help help here. Obviously, thereis 
> something I do not understand. Is this data just not available from the 
> ticket yet? I do not have the cf defined for a transaction. Thanks.

Here's what I have in one of my conditions for new tickets.  It 
basically checks to see if the field is valued, and if not, the action 
will set a default value:

sub IsApplicable
{
	my($self) = shift;

	my($CFNAME) = 'FooBarBaz';

	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);
}

This works on 3.6.3

-- 
Regards,


joe
Joe Casadonte
joe.casadonte at oracle.com

==========                                                  ==========
== The statements and opinions expressed here are my own and do not ==
== necessarily represent those of Oracle Corporation.               ==
==========                                                  ==========



More information about the rt-users mailing list