[rt-users] changing status/owner via email pt2
Ruslan U. Zakirov
Ruslan.Zakirov at acronis.com
Tue Jan 25 16:38:09 EST 2005
Elaine . wrote:
> hi
> I tried the code below, no errors in the log, although
> it strips out in the fault the Set-Owner or Set-Status
> (good) that is logged, there are no emails sent as the
What is logged?
> only scrip i have set is user defined and nothing in
> that says send an email ? If i then do another scrip
This scrip can't send email, it change properties. So use blank template
with it.
> as "on correspond, reply to requestor with template
> correspondence" then nothing gets stripped as its in
> the other scrip ? Maybe i'm misunderstanding how i
Hmm. Scrip execution order is unpredictable :( in RT. And this is
very-very bad. Possible that RT runs "notify" first and only then runs
your custom one. Move code from custom commit block to custom prepare block.
> should be setting things up ?
>
>
> 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/^\QSet-Owner:\E\s*(\S+)\s*$/m ) {
>
> $self->TicketObj->SetOwner( $1 );
> }
> if( $content =~ m/^\QSet-Status:\E\s*(\S+)\s*$/m ) {
>
> $self->TicketObj->SetStatus( $1 );
> }
>
> # strip special commands from email content
> $content =~ s/^\QSet-Status:\E\s*(\S+)\s*$//gm;
> $content =~ s/^\QSet-Owner:\E\s*(\S+)\s*$//gm;
>
> # silently overwrite attachment content
> $AttachObj->__Set( Field => 'Content', Value =>
> $content );
>
> 1;
>
>
>
>
>
> ___________________________________________________________
> ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> RT Administrator and Developer training is coming to your town soon! (Boston, San Francisco, Austin, Sydney) Contact training at bestpractical.com for details.
>
> Be sure to check out the RT Wiki at http://wiki.bestpractical.com
More information about the rt-users
mailing list