[rt-users] scipts not working

Violetta J. Wawryk v.wawryk at science-computing.de
Thu Mar 24 06:17:13 EDT 2011


Hi List,

RT: 3.6.7, debian5

sorry, I don't know what I am doing wrong, it must be my lack of pearl 
knowledge. I have the following scrip, with which I want to set a 
customfield value via email contents:

***************************************************
Custom condition:

my $AttachObj = $self->TransactionObj->Attachments->First;

if (($self->TransactionObj->Type eq "Create") && ($AttachObj->Content =~ 
/RT-Set-Test\:/)) {
       return(1);
} else {
  return(undef);
}

***************************************************
Custom action prep code:

$RT::Logger->info("Automagic Ticket change");
1;

my $AttachObj = $self->TransactionObj->Attachments->First;
# go out if content is not text!
unless( $AttachObj->ContentType =~ /^text/ ) {

      return 1;
}

my $content = $AttachObj->Content;
if( $content =~ m/^\QRT-Set-Test:\E\s*(\S+)\s*$/m ) {

      $self->TicketObj->AddCustomFieldValue( Field => 'muethos-test: 
test', Value => $1 );
}

# strip special commands from email content
$content =~ s/^\QRT-Set-Test:\E\s*(\S+)\s*$//gm;

# silently overwrite attachment content
$AttachObj->__Set( Field => 'Content', Value => $content );

1;
***************************************************

Custom action cleanup code:

return( 1 );

***************************************************


My customfield is: "enter one value" (I also tried "enter multiple values)

If I send an email with the following contents


RT-Set-Test: Test


it works perfectly fine, my customfield "muethos-test: test" contains Test.

But I want more than just one word, I tried the following:


RT-Set-Test: Test 1
RT-Set-Test: 'Test 1'
RT-Set-Test: "Test 1"
RT-Set-Test:'Test 1'

all of them do not work.

Can anyone help me?

Thanks a lot.
Violetta



-- 
________________________________ creating IT solutions
Violetta J. Wawryk               science + computing ag
IT-Service                       Hagellocher Weg 73
phone +49 7071 9457 282          72070 Tuebingen, Germany
fax   +49 7071 9457 211          www.science-computing.de
-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 





More information about the rt-users mailing list