[Rt-devel] Problem with DefaultCustomFieldValue
Juan Ramón Alfageme Mata
JRamon.Alfageme at alhambra-eidos.com
Mon Feb 28 09:48:39 EST 2005
I tried swapping both (cleanup and preparation code) I tried too using global and queue scripts alone and together.
Custom field is global.
Juan Ramón Alfageme Mata
+34 91 787 23 00 alhambra-eidos.com
-----Mensaje original-----
De: Andy Harrison [mailto:aharrison at gmail.com]
Enviado el: viernes, 25 de febrero de 2005 15:19
Para: Juan Ramón Alfageme Mata
CC: rt-devel at lists.bestpractical.com
Asunto: Re: [Rt-devel] Problem with DefaultCustomFieldValue
On Wed, 23 Feb 2005 13:04:05 +0100, Juan Ramón Alfageme Mata
<JRamon.Alfageme at alhambra-eidos.com> wrote:
> 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
>
>
I think you have your prep and cleanup blocks backwards. Try
switching that. You should probably wipe out either the global or
queue specific scrip while you're testing. Unless that's a global
custom field, you should probably wipe out the global scrip.
--
Andy Harrison
More information about the Rt-devel
mailing list