Hi Kenn,
In addition to what Steve pointed out, I think you have an error in your
condition code. The second term of
$self->Ticket->FirstCustomFieldValue('Approval-Status')
should probably be TicketObj instead of Ticket.
Something I started doing with my scrips to avoid making Ticket/TicketObj
mistakes when jumping between scrips and templates is I always start my
scrips off with the following 2 lines:
my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;
Now I can just copy code snippets between templates and scrips without
having to change any of the Transaction or Ticket references (for instance,
ticket status is $Ticket->Status whether it's in a scrip or
template). This is especially handy when I have subroutines that I use in
both scrips and templates. Plus I never get the $self->Ticket or
$self->$TicketObj errors anymore.
Gene
At 10:14 PM 5/7/2007, 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
_______________________________________________
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
--
Gene LeDuc, GSEC
Security Analyst
San Diego State University
_______________________________________________
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