SV: [rt-users] I just can't figure out how to get the values from mycustom fields!

Brian Kjelin Olsen BKO at schilling.dk
Mon Mar 5 19:30:01 EST 2007


Thank you, Joe, for your answer.

That is correct and yet not, I'm afraid.
You are showing a way to check the custom fields on tickets, but I need
to get values from custom fields on ticket-transactions.

However it got me to recheck that I actually had defined the fields as
global. 
In the example I had written I could actually print out the field names
from the object but not the values. The fields are there - global or not
:-)

- Brian

-----Oprindelig meddelelse-----
Fra: Joe Casadonte [mailto:joe.casadonte at oracle.com] 
Sendt: 5. marts 2007 16:10
Til: Brian Kjelin Olsen
Cc: rt-users at lists.bestpractical.com
Emne: Re: [rt-users] I just can't figure out how to get the values from
mycustom fields!

On 3/5/2007 3:08 AM, Brian Kjelin Olsen wrote:

> I just can't figure how to get the values of custom fields on ticket
transactions from scrip.

Here's what I've done in a Condition's IsApplicable() sub:

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

Hope that helps!

-- 
Regards,


joe

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|           Joe Casadonte           |  joe.casadonte at oracle.com     |
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| Oracle Transportation Management  |  1016 West Ninth Avenue       |
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|  Suite 300                    |
|           610-491-3315            |  King of Prussia, PA  19406   |
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





More information about the rt-users mailing list