[rt-users] notification

Kevin Falcone falcone at bestpractical.com
Fri Dec 10 15:23:28 EST 2010


On Fri, Dec 10, 2010 at 12:08:05PM -0800, Kenneth Crocker wrote:
>    Kevin,
>    The template would look like this:

Kenn

I'm perfectly able to write the scrip and template in question, but
since Kurt has a half-working template I was curious what *he* was
doing.  Involving a CustomField seems like a bit of overkill.

-kevin

>    To: {$Ticket->FirstCustomFieldValue('ToOverride')}@[1]lbl.gov
>    Subject: Request Titled: "{$Ticket->Subject}" is ready to Migrate!
> 
>    A scrip based on whatever condition would do this:
> 
>    my $trans = $self->TransactionObj;
>    my $ticket = $self->TicketObj;
>    my $cf_obj = new RT::CustomField($RT::SystemUser);
>    my $cf_name = "ToOverride";
> 
>    if condition is "A"
>    $my $cf_value = "the To address you want for "A" condition";
>    elsif condition is "B"
>    $my $cf_value = "the To address you want for "B" condition";
> 
>    and on and on till you're thru.
> 
>    then, set the Custom Field as the last piece of action code:
> 
>    $cf_obj->LoadByName(Name=>$cf_name);
>    $RT::Logger->debug("Loaded\$cf_obj->Name = ". $cf_obj->Name() ."\n" );
>    $ticket->AddCustomFieldValue( Field=>$cf_obj, Value=>$cf_value, RecordTransaction=>0 );
> 
>    return 1;
> 
>    Then write a notification scrip to use the new template based on your conditions.
>    Use "TransactioBatch" for both scrips.
> 
>    Hope this helps.
> 
>    Kenn
>    LBNL
> 
>    On Fri, Dec 10, 2010 at 11:55 AM, Kevin Falcone <[2]falcone at bestpractical.com> wrote:
> 
>      On Fri, Dec 10, 2010 at 11:07:32AM -0800, Kurt Engle wrote:
>      > Actually found a nice example of creating a template to send out an e-mail. RTFM....
>      >
>      > However, I am having a bit of a problem constructing the To: field. Basically, I have a
>      > varialble '$toAddress' that is set to an e-mail address by some prior code.
> 
>      Where in the code is it set. It would really need to be in that
>      template
>      > Here is my template code to construct the To: field:
>      > To: { $toAddress }
>      > Subject: Ticket #{ $Ticket->Id()} {$Ticket->Subject()}
>      > A new ticket has been created for you in the HelpDesk Queue.
>      >
>      > { $RT::WebURL } Ticket/Display.html?id={ $Ticket->Id() }
>      >
>      > However, I keep getting 'recipient not found'.
> 
>      In debug logging mode, RT will actually dump copies of the email being
>      processed into the logs, which would show you the To:
> 
>      Please note that if To: is your email address and you're the actor on
>      this ticket while testing, you may have told RT not to send you email
>      in that case using $NotifyActor
>      -kevin
> 
>      >
>      ----------------------------------------------------------------------------------------------
>      >
>      > From: "Kevin Falcone" <[3]falcone at bestpractical.com>
>      > To: [4]rt-users at lists.bestpractical.com
>      > Sent: Friday, December 10, 2010 10:03:04 AM
>      > Subject: Re: [rt-users] notification
>      >
>      > On Fri, Dec 10, 2010 at 09:55:07AM -0800, Kurt Engle wrote:
>      > > That is correct. But how do I make use of the RT::Action::SendEmail module to send the
>      > > notification incorporating my To: field. Or is there a better way to send out a custom
>      > > notification?
>      >
>      > You use one of the standard Notify actions and a custom template. You
>      > don't write any code in the action and you don't call the action
>      > directly.
>      >
>      > -kevin
>      >
>      > > From: "Kevin Falcone" <[5]falcone at bestpractical.com>
>      > > To: [6]rt-users at lists.bestpractical.com
>      > > Sent: Friday, December 10, 2010 8:59:25 AM
>      > > Subject: Re: [rt-users] notification
>      > >
>      > > On Thu, Dec 09, 2010 at 11:42:03AM -0800, Kurt Engle wrote:
>      > > > I am looking for a way to send an email from RT to a specified e-mail address that
>      > is not
>      > > an
>      > > > account in RT or associated with the ticket as a requestor, watcher, CC:,
>      > BCC:...etc....
>      > > >
>      > > > I have the logic down to specify the e-mail address and have some nasty perl code to
>      > > actually
>      > > > send the e-mail. But, it seems that RT has some internal module(s) that handle what
>      > the
>      > > nasty
>      > > > perl code is doing.
>      > > >
>      > > > I can see the RT::Action:SendEmail module, but how do I incorporate that into a
>      > script
>      > > that
>      > > > allows me to do what I am looking to do?
>      > >
>      > > Sounds like you actually just want to use a normal Notify action, but
>      > > have the template contain your ugly logic that sets up the To: line
>      > > based on your perl code
>      > >
>      > > -kevin
> 
> References
> 
>    Visible links
>    1. http://lbl.gov/
>    2. mailto:falcone at bestpractical.com
>    3. mailto:falcone at bestpractical.com
>    4. mailto:rt-users at lists.bestpractical.com
>    5. mailto:falcone at bestpractical.com
>    6. mailto:rt-users at lists.bestpractical.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20101210/a0a2f003/attachment.sig>


More information about the rt-users mailing list