[rt-users] Proxy "requestors" and elegance

jul jul-rt at julbox.net
Thu Apr 30 13:36:01 EDT 2009


I have a scrip working well, but I am fairly unsatisfied with it ; I dont
find it elegant. So if you have any opinions regarding improvement of my
solution, please share. ;)

A customer want to open ticket and a subsitute to handle Questions and
Answers. Still the customer want to receive acknowledement at the end, and
have the possibility to track its mail.

My Solution
Having a CF with initial requestor filled on owner Change
Having a onResolve custom scrips substituting back

My problem : to ensure the custom OnResolve he is called before OnResolve
final template is sent.

Other problems :
Do I stock substitution in a Queue customField (how do I access it ?) Do I
stock susbtitution per queue  in a custom hash that would associate a
queue name to a substitution in RTSite_Config?
Rights tips so that this custom field cannot be changed or seen.

What are your opinions?


### File ou l'on fait la manip

my @queues = (5,6,7,8,9,10,11,12,13,14, 15);
my $queue_id = $self->TicketObj->Queue;

my $in_queue=  grep { /^${queue_id}$/  } @queues;
if ( ! $in_queue ) {
# si file pas intéressante on arrete
    return 1;

my $ProxyEmail=q{substitue at mydomain.com};

my @adresses=$self->TicketObj->Requestors->MemberEmailAddresses;
my $substitution="";

foreach  my $mail (@adresses) {
# matching customers emails (per domain)
if ($mail=~ /mycustomer(.*)fr$/) {

$self->TicketObj->AddWatcher(Type => "Requestor", Email => $ProxyEmail);
$substitution.=qq{$mail from customer changed to $ProxyEmail \n};

my $CFObj = RT::CustomField->new( $RT::SystemUser );
$CFObj->LoadByNameAndQueue( Name => "initialrequestor", Queue => $queue_id );

 my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
      Field => $CFObj->id,
      Value => $mail,
      RecordTransaction => 1
    unless (  $st ) {
      $RT::Logger->error( "SCRIP: substitution : Set fields :: $mail not
substitued  :". $msg );
      return 1;

$self->TicketObj->DeleteWatcher(Type => "Requestor", Email => $mail);

if ("$substitution) {
$self->TicketObj->Comment(Content => <<END);

return 1;



my $CF = RT::CustomField->new( $RT::SystemUser );
if (!$initial_mail) {
# pas de bras pas de chocolat
return 1 ;

$self->TicketObj->AddWatcher(Type => "Requestor", Email => $initial_mail);

### on enlève le proxy
my $ProxyEmail      = q{substitue at mydomain.com};

my @adresses=$self->TicketObj->Requestors->MemberEmailAddresses;
my $substitution="";
foreach  my $mail (@adresses) {
if ($mail== $ProxyEmail) {

$self->TicketObj->DeleteWatcher(Type => "Requestor", Email => $ProxyEmail);

$substitution="$ProxyEmail subsituted by $initial_mail";

$self->TicketObj->Comment(Content => <<END);

return 1;

Julien Tayon // digital craftsman // making things simpler (when possible)

A lot of people I know believe in positive thinking, and so do I.  I
believe everything positively stinks.
		-- Lew Col

More information about the rt-users mailing list