[rt-users] RT tool & RecordTransaction => 0
Bart
bart at pleh.info
Thu Dec 8 08:00:20 EST 2011
I think I've finished it, only have some issues with the $RT::Logger->error
thing. The scrip won't launch when I have that part enabled, when disabled
it runs just fine O_o
package RT::Action::TEST;
use base 'RT::Action';
use strict;
use warnings;
sub Prepare {
return 1;
}
sub Commit {
my $self = shift;
my $tstatus = $self->TicketObj->Status;
if ($tstatus eq 'new') { my ($val, $msg) =
$self->TicketObj->AddCustomFieldValue(Field => 'Teller New', Value =>
$self->TicketObj->FirstCustomFieldValue( 'Teller New' ) + 5,
RecordTransaction => 0 ); }
if ($tstatus eq 'open') { my ($val, $msg) =
$self->TicketObj->AddCustomFieldValue(Field => 'Teller New', Value =>
$self->TicketObj->FirstCustomFieldValue( 'Teller New' ) + 5,
RecordTransaction => 0 ); }
# --- Insert more if statements to match more ticket statusses. ---
# --- the part below doesn't seem to work, no idea why. ---
#unless ( $val ) {
# $RT::Logger->error("Coudln't change Custom Field: $msg");
# return 0;
#}
return 1;
}
1;
-- Bart
Op 8 december 2011 12:31 schreef Bart <bart at pleh.info> het volgende:
> Ok,
>
> Will do a little more adjusting, thanks for the help.
>
> -- Bart
>
>
> Op 8 december 2011 12:28 schreef Ruslan Zakirov <ruz at bestpractical.com>het volgende:
>
> On Thu, Dec 8, 2011 at 14:46, Bart <bart at pleh.info> wrote:
>> > sub Prepare {
>> > my $self = shift;
>> > my $new_value = $self->TicketObj-> FirstCustomFieldValue( 'Teller
>> New' )
>> > + 5;
>> > $self->TicketObj->AddCustomFieldValue(Field => 'Teller New', Value
>> =>
>> > $new_value, RecordTransaction => 0 );
>> > return 1;
>> > }
>>
>> You should move all this code into Commit. Don't change objects during
>> prepare.
>>
>> --
>> Best regards, Ruslan.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20111208/51a8dcb2/attachment.htm>
More information about the rt-users
mailing list