[rt-users] Assign on reply

Travis Campbell travis.campbell at amd.com
Tue Nov 8 18:07:31 EST 2005


On Tue, Nov 08, 2005 at 04:15:18PM -0500, Haim Dimer wrote:
> I have an email address all my customers use to contact us  
> (support@). Whenever they send an email to this address, it creates a  
> ticket. That's great.
> 
> Now I have noc people replying to these emails, which goes through RT  
> and changes the status of a ticket from new to open when there is a  
> reply. That's great.
> 
> I want RT to automatically assign the ticket to the person who first  
> replied to the ticket email. RT needs to be sure that this person is  
> an RT user. I think that's what the scrips are for, I'm just not sure  
> as to how to do it.

You can do this by creating a custom scrip:

Description:  Auto take on correspond
Condition:  User defined
Action: User defined
Template:  Blank
Stage: Transaction Create

Custom Condition:
    if ($self->TransactionObj->Type eq "Correspond" or
        $self->TransactionObj->Type eq "Comment") {
        return 1;
    } else {
        return undef;
    }

Custom Action Preparation:

    return 1;

Custom Action Code:

    # get actor ID
    my $Actor = $self->TransactionObj->Creator;


    # if actor is RT_SystemUser then get out of here
    return 1 if $Actor == $RT::SystemUser->id;

    # get out unless ticket owner is nobody
    return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;

    # bail if no right to own ticket
    return 1 unless $self->TransactionObj->CreatorObj->HasRight( 
        Object => $self->TicketObj->QueueObj, 
        Right=> 'OwnTicket'
    );

    # ok, try to change owner
    $RT::Logger->info("Auto assign ticket #" . 
        $self->TicketObj->id ." to user #". $Actor );
    my ($status, $msg) = $self->TicketObj->SetOwner( $Actor );
    unless( $status ) {
        $RT::Logger->warning( "Failed to assign to $Actor: $msg" );
        return undef;
    }
    return 1;


Travis
-- 
 Travis Campbell  -  Unix Systems Administrator =    travis at mpdtxmail.amd.com
    5900 E. Ben White Blvd, Austin, TX 78741    =     travis.campbell at amd.com
    TEL: (512) 602-1888  PAG: (512) 604-0341    = webmaster at mpdtxmail.amd.com  
=============================================================================
      "Does anything work as expected?"  Yes.  An axe through the CPU.




More information about the rt-users mailing list