[rt-users] Notify via SMS if ticket Subject =~ /urgent/i

EJ Marmonti eugenejames at gmail.com
Fri Jul 26 15:54:43 EDT 2013


Kevin:

Unfortunately following your suggestion didn't help.

The reason I check for a status change = new (rather than Condition=On
Create) is because the latter will send me an SMS everytime any ticket is
opened, regardless of the subject contents (as I would expect it to do
given that it says to "*Use these fields when you choose 'User Defined' for
a condition or action").

*So what I'm not sure of is if I have a fundamental misunderstanding of how
this is supposed to work, or perhaps something with the way I'm trying to
search for the word 'urgent' in the subject is not correct - ie: where
should that bit of code go if Condition=On Create?

For what I'm trying to accomplish, might it be better to create a custom
Condition?
ie:

rt-setup-database --action insert --datafile
/usr/local/rt/lib/RT/Condition/Foo.pm?

In that case, should it in theory show up as an available action from the
drop-down of available actions?


Thanks




Date: Fri, 26 Jul 2013 08:52:37 -0400
From: Kevin Falcone <falcone at bestpractical.com>
To: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] Notify via SMS if ticket Subject =~ /urgent/i
Message-ID: <20130726125237.GR22003 at jibsheet.com>
Content-Type: text/plain; charset="us-ascii"

On Thu, Jul 25, 2013 at 01:15:33PM -0400, EJ Marmonti wrote:
>    The portion of sending the SMS message itself I figured out so that's
less of a concern - in
>    the template, I just CC the sms address (if Action=Notify AdminCCs',
this works), though I am
>    open to other suggestions. It's the scrip itself that I'm really
having issues with.
>
>    What I have so far:
>
>    Description: On create URGENT, notify SMS
>    Condition: On Transaction
>    Action: User Defined
>    Template: On Create Urgent ticket, notify SMS
>    Stage: TransactionCreate

If you have an Action of User Defined, your Template isn't going to be
used unless you're loading it up and sending mail manually.

It sounds to me like you actually wanted
Condition: User Defined
Action: Notify Other Recipieints or Notify Ccs or a custom notify
action created with
http://bestpractical.com/docs/rt/latest/rt-email-group-admin.html

You can combine your Custom action prep code and Custom action cleanup
code into that condition, although I am a little confused.  You
apparently only want to check the subject if the status of the ticket
changes (rather than say when the ticket is created?) but that may be
what you wanted.

-kevin

>    ===Custom condition: n/a
>
>    ===Custom action prep code:
>    my $txn = $self->TransactionObj;
>    my $type = $txn->Type;
>    return 0 unless $type eq "Status"
>    || ( $type eq 'Set' && $txn->Field eq 'Status');
>
>    return 0 unless $txn->NewValue eq "new";
>
>    ===Custom action cleanup code:
>
>    my $subject = $self->TicketObj->Subject;
>
>    if ($subject =~ /urgent/i) {
>    return 1;
>    }
>    else {
>    return 0;
>    }
>
>    I found some decent references out there, but this isn't sending the
notification and I'm
>    stumped. I know there are many people out there who have done the
equivalent of what I'm
>    trying to accomplish.
>
>    Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 235 bytes
Desc: not available
URL: <
http://lists.bestpractical.com/pipermail/rt-users/attachments/20130726/e4266325/attachment-0001.pgp
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130726/be534820/attachment.html>


More information about the rt-users mailing list