At Tuesday 5/8/2007 01:14 AM, Kenneth Crocker wrote:
To all,

        I  have created the following scrip/conditions:

        Condition: User Defined
        Action: Notify AdminCc's, Cc's, Requestors
        Template: Reviewed (new template created as well)

        Custom Condition:

        # condition execution on ticket status and Custom Field value

        return ($self->TicketObj->Status eq "new" &&
                $self->Ticket->FirstCustomFieldValue('Approval-Status')
                eq "Reviewing Request");
        return 0;

        Custom Action Preparation Code: none

        Custom Action Cleanup code:

        # set new status for work-status

        my $cf_obj;
        my $cf_name;
        my $cf_value;

        $cf_obj = RT::CustomField->new($RT::SystemUser);
        $cf_name = "Work-Status";
        $cf_value = "Pending Decision";
        $RT::Logger->debug( $self . " cf_value = ". $cf_value . "\n" );
        $cf_obj->LoadByName( Name => $cf_name );
$RT::Logger->debug( "Loaded \$cf_obj->Name = ". $cf_obj->Name() ."\n" ); $cf_obj->AddValueForObject( Object=>$self->TicketObj, Content=>$cf_value, );

        # set new status for ticket

        $RT::Logger->debug( $self->TicketObj->SetStatus("pending rv");


        I have also added the new ticket status value in my RT Configuration.

My problem is 1; I get a template sent out that I did not ask for (I get new owner like for an owner change).
        2; the ticket status doesn't get changed.

        Any ideas?  Thanks.

Kenn
LBNL


Hi Kenn,

One question - what action in RT are you hoping will trigger this scrip?

Re the two problems:

1) The unasked-for template email must be generated by a different scrip - there's no way this scrip could use a template other than the one you specified.

2) The custom condition code seems problematic - it doesn't check for transaction type, which means it will return 1 for ANY ticket transaction for a ticket with status = new and custom field = your value. Is that what you want, or do you want to capture a CF change?

Also, by trying to change status in the scrip action, you may be running into the problem with whatever status value was on the screen overriding your scrip change.

Hope this is helpful,
Steve
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com

Reply via email to