[rt-users] Scrip Question
Ruslan U. Zakirov
cubic at acronis.ru
Wed Sep 24 11:36:07 EDT 2003
Derek Buttineau wrote:
> Please excuse me if this is a silly or repetitive question, but I'm
> trying to create a scrip that changes the owner to nobody on a ticket
> if a user corresponds back to the ticket..
>
> I have the following setup, but nothing seems to be happening..
>
> Condition: User Defined
> Custom Condition:
>
> if (($self->TransactionObj->Type eq "Correspond") and
> ($self->TicketObj->OwnerObj->Id != $RT::Nobody->Id)) {
> return(1);
> } else {
> return(undef);
> }
>
> Action: User Defined
> Custom action prep:
First of all you don't need this 'IF' you have allready checked it in
condition. Don't you think so?
>
> my $retval = undef;
> if ( defined( $self->TicketObj->OwnerObj->id ) ){
> if( $self->TicketObj->OwnerObj->Id != $RT::Nobody->Id ){
> $retval = 1;
> }
> }
You don't have return here !
return $retval;
Turn on debug to separate file in RT's config. Each step of user defined
scrips go through "eval"s and log nay error.
>
>
> Custom action cleanup:
>
> my $retval = undef;
> if ($self->TransactionObj->CreatorObj->Id !=
> $self->TicketObj->OwnerObj->Id)
> {
> $RT::Logger->info("Untake ticket");
> # They don't own the ticket. Untake it.
> $retval = $self->TicketObj->SetOwner($RT::Nobody->Id);
> }
> return( $retval );
>
> Template: Global template: Blank
May be better deny to take tickets that were requested by somebody else?
>
>
> Am I missing something? Please enlighten :)
>
More information about the rt-users
mailing list