Dear All, I am trying to achieve something very similar but somehow I run into the same problem and I am not able to read the value from my custom field.
I am on rt 3.4.1 - debian.
CustomField2 is a ticket transaction custom field. It is a selection of
a value and either "Yes" or "No"
Building on the previous information in this thread my custom condition is:
$RT::Logger->debug("Get names of transaction Custom fields from the
ticket object");
if (my $TCFs = $self->TicketObj->TransactionCustomFields())
{
while (my $CF = $TCFs->Next()) {
$RT::Logger->debug("Get values from transaction custom field '"
. $CF->Name . "' from the transaction object");
my $values = $self->TransactionObj->CustomFieldValues($CF->Name);
my $CFV = $values->Next();
$RT::Logger->debug("Inhalt ist:");
$RT::Logger->debug($CFV->Content);
}
$RT::Logger->debug("End of getting values from transaction
custom field from the transaction object");
}
$RT::Logger->debug("End of getting names of transaction Custom fields
from the ticket object");
return (1);
Based on the content of this custom field, I would like the condition to
return 1 or return undef.
I get the following in my log:
[Tue Mar 6 13:21:11 2007] [debug]: Get values from transaction custom
field 'CustomField2' from the transaction object ((eval 499):11)
[Tue Mar 6 13:21:11 2007] [error]: Scrip 22 IsApplicable failed: Can't
call method "Content" on an undefined value at (eval 499) line 15.
Any help would be greatly appreciated. So far I was not able to access
the custom field value at all.
Many many many thanks for any help in advance,
Bestest
Tobias Heinz
Brian Kjelin Olsen schrieb:
Please forget my "odd problem #1) Scrip "condition" and "preparation code" is - of course - executed before the transaction and "cleanup code" after the transaction - sorry about that!Anyway, the problem about getting the CF values on ticket transactions still remains - even from the cleanup code ;-) Med venlig hilsen / Best regards Brian Kjelin Olsen Schilling A/S -----Oprindelig meddelelse----- Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af Brian Kjelin Olsen Sendt: 6. marts 2007 01:30 Til: Stephen Turner; [email protected] Emne: SV: [rt-users] I just can't figure out how to get the values frommycustom fields! Hi Steve I did try your code example with enthusiasm but still there weren't any values. I did notice 2 odd things (well... odd to me at least). 1) The scrip is executed in the same moment when the user press comment, reply, etc. This is just before the ticket transaction custom fields are presented and that is for sure a reason why I never get any values! I really wonder why the scrip is executed (before?) the transaction?!? I mean 2) The scrip part "Custom action cleanup code" wasn't executed. I can't figure out why, but suddenly it did execute that action part again. I'm sure that I must have done something wrong - but shouldn't it only be from the condition part you can control whether to execute both action parts or not? It really doesn't matter too much to me. It just seems odd, and odd was what I was looking for. It seems that is was "still close but no cigar" :-) Thanks anyway! - Brian -----Oprindelig meddelelse-----Fra: Stephen Turner [mailto:[EMAIL PROTECTED] Sendt: 5. marts 2007 19:34Til: Brian Kjelin Olsen; [email protected] Emne: Re:[rt-users] I just can't figure out how to get the values from mycustom fields!---------------------It looks like you're pretty close -$self->TransactionObj->CustomFieldValues($CF->Name) will give you an ObjectCustomFieldValues collection object - each member of the collection is an ObjectCustomFieldValue object. You can iterate over the collection and see the values something like this:my $values = $self->TransactionObj->CustomFieldValues($CF->Name); while (my $CFV = $values->Next() ) { $RT::Logger->debug($CFV->Content); } Steve _______________________________________________ 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_______________________________________________ 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
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ 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
