Carlos,
Sounds like you are creating a situation where the ticket status is
constantly switched between "open" and "stalled" every time the
Requestor and ticket owner communicate to each other. Seems a bit busy
but hey, if that's what you want. Try something like this:
*Scrip 1 - Owner reply:*
/Condition: On Correspond
Custom Prep Code:/
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $corresponder_id = $trans->CreatorObj->PrincipalId;
my $requestor = $ticket->Requestors->UserMembersObj->First->PrincipalId;
my $owner_id = $ticket->OwnerObj->PrincipalId;
my $cf_obj = RT::CustomField->new($RT::SystemUser);
my $cf_name = " ";
my $cf_value = " ";
# set new value for CF Support Status depending on who initiates
correspondence
if ( $corresponder_id = $requestor )
{
$cf_name = "Support Status";
$cf_obj->LoadByName( Name => $cf_name );
$RT::Logger->debug( "Loaded \$cf_obj->Name = ". $cf_obj->Name()
."\n" );
$ticket->AddCustomFieldValue( Field=>$cf_obj, Value=>$cf_value,
RecordTransaction=>0 );
$cf_name = "AutoClosure";
$cf_obj->LoadByName( Name => $cf_name );
$RT::Logger->debug( "Loaded \$cf_obj->Name = ". $cf_obj->Name()
."\n" );
$ticket->AddCustomFieldValue( Field=>$cf_obj, Value=>$cf_value,
RecordTransaction=>0 );
$ticket->SetStatus("open");
}
elseif ( $corresponder_id = $owner )
{
$cf_name = "Support Status";
$cf_value = "Awaiting Customer";
$cf_obj->LoadByName( Name => $cf_name );
$RT::Logger->debug( "Loaded \$cf_obj->Name = ". $cf_obj->Name()
."\n" );
$ticket->AddCustomFieldValue( Field=>$cf_obj, Value=>$cf_value,
RecordTransaction=>0 );
$ticket->SetStatus("stalled");
}
return 1;
/Custom Cleanup Code:/
return 1;
I'm not sure the "ID" part of the code is correct, but the key is to get
the Owner & Requestor ids and then compare them to the id of the person
doing the correspondence and then based on those results, set your CF's
and ticket status. If there is no match, then someone else is doing the
correspondence and you want to stop. One scrip to handle all that for
correspondence. Hope this helps.
Kenn
LBNL
On 7/13/2009 6:59 PM, Carlos A. Alvarez wrote:
I will like to create a scrip where the status of a ticket is
automatically changed from open to stalled when a Owner replies to a
requestor. I am using rt-crontool to monitor the status of the tickets
and auto resolve the ticket after 72 hours of inactivity. I created a
custom field to monitor the status of the crontool, but my problem is
that when the customer replies, I can’t rely on my techs to change the
status of the ticket manually.
I tried creating User Defined Scrip which works fine, exept it
executes each time, indiscriminately. Let me try to explain, I have
one script that changes the status from open to stalled, when a
technician replies, and another that changed the status back to open
when the customer/requestor replies. I can see that both scrips are
executing at the same time regardless of who initiated the
correspondence.
I know that I am missing something basic, but I don’t know what. Can
anyone help.
Scrip 1 customer reply
$self->TicketObj->AddCustomFieldValue(Field => 'Support Status', Value
=> ' ');
$self->TicketObj->AddCustomFieldValue(Field => 'AutoClosure', Value =>
' ');
$self->TicketObj->SetStatus("open");
return 1;
Scrip 2 Owner reply
$self->TicketObj->AddCustomFieldValue(Field => 'Support Status', Value
=> 'Awaiting Customer');
$self->TicketObj->SetStatus("stalled");
return 1;
Thanks…
------------------------------------------------------------------------
_______________________________________________
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
_______________________________________________
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