[Rt-devel] Problem with DefaultCustomFieldValue

Juan Ramón Alfageme Mata JRamon.Alfageme at alhambra-eidos.com
Wed Feb 23 07:04:05 EST 2005


Now I have the following global and queue specific scripts, but still nothing happens.

Condition: On Transaction
Custom Condition:
Action: User defined
Custom action preparation code: return 1;
Custom action cleanup code:
my $CFName = 'Provider';
my $DefaultValue = 'BT';
my $RecTransaction = 1;

my $QueueObj = $self->TicketObj->QueueObj;
my $CFObj = RT::CustomField->new( $QueueObj->CurrentUser );
$CFObj->LoadByName( Name => $CFName, Queue => $QueueObj->id );
unless( $CFObj->id ) {
$CFObj->LoadByName( Name => $CFName, Queue => 0 );
unless( $CFObj->id ) {
$RT::Logger->warning( "$CFName doesn't exist, Queue -". $QueueObj->Name ."-" );
return undef;
}
}

unless( $self->TicketObj->FirstCustomFieldValue( $CFObj->id ) ) {
my( $st, $msg ) = $self->TicketObj->SetContent(
Field => $CFObj->id,
Value => $DefaultValue,
RecordTransaction => $RecTransaction );
unless( $st ) {
$RT::Logger->warning( "Couldn't set $DefaultValue as value for CF $CFName:". $msg );
return undef;
}
}
return 1;
Template: Global template: Blank



More information about the Rt-devel mailing list