[rt-users] scipts not working
Christian Loos
cloos at netcologne.de
Thu Mar 24 09:54:20 EDT 2011
Try change the regexp from
$content =~ m/^\QRT-Set-Test:\E\s*(\S+)\s*$/m
to
$content =~ /RT-Set-Test:\s*(.+)$/mg;
-Chris
Am 24.03.2011 11:17, schrieb Violetta J. Wawryk:
> 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
>
>
>
More information about the rt-users
mailing list