[rt-users] Custom Condition To Send Email on Resolve if No Article Sent as Part of Resolve

Alex Peters alex at peters.net
Sat Aug 2 22:29:36 EDT 2014


This comment seems to refer to a ticket when it's being created, rather
than when correspondence is being added to it later.  I don't think it's
relevant in your case.


On 3 August 2014 11:33, Foggi, Nicola <NFOGGI at depaul.edu> wrote:

>
> I'm thinking this comment in Ticket.pm might be related to what I'm seeing:
>
>     # Deal with setting up links
>
>     # TODO: Adding link may fire scrips on other end and those scrips
>     # could create transactions on this ticket before 'Create' transaction.
>     #
>     # We should implement different lifecycle: record 'Create' transaction,
>     # create links and only then fire create transaction's scrips.
>     #
>     # Ideal variant: add all links without firing scrips, record create
>     # transaction and only then fire scrips on the other ends of links.
>     #
>     # //RUZ
>
> Looks like that comment still exists in the 4.2 code?  Any ideas on a
> workaround if this is indeed what I'm running into?
>
> Nicola
>
> ________________________________________
> From: Foggi, Nicola
> Sent: Saturday, August 02, 2014 7:45 PM
> To: rt-users at lists.bestpractical.com
> Subject: Custom Condition To Send Email on Resolve if No Article Sent as
> Part of Resolve
>
> Version : RT-4.0.19
>
> Hey All,
>
> Running into a slight problem with a new queue I'm attempting to roll out
> a new queue that uses some "pre-canned" template responses using Articles
> from the integrated RTFM system in 4.0.19 now.  I've changed the lifecycle
> to make the open -> resolve a default RESPOND vs COMMENT and that's
> working.  However, I want to send a default template response if the admin
> forgets to choose an article to respond with.  I came up with the following
> code below for the custom codition.  I'm detecting if the ticket has a
> ReferTo set and then if it doesn't return code 1 to that the scrip executes
> which sends the template, otherwise, sets it to 0 so it skips the scrip.
>
> The problem I'm running into is it appears the run the scrip prior to
> linking the article to ticket, so it always thinks the admin hasn't
> attached an article when they actually have.  Is there anything I can do to
> execute the scrip post process of attaching the article (I tried setting it
> to Transaction Batch).
>
> Any ideas would be greatly appreciated.
>
> Thanks
>
> Nicola
>
> [custom condition below]
>
> my $RefersToTickets = $self->TicketObj->RefersTo;
> my $FirstRefersToTicketLink = $RefersToTickets->Next;
>
> my $returncode = 0;
>
> my $txn = $self->TransactionObj;#
> my $type = $txn->Type;
> return 0 unless $type eq "Status"
>     || ( $type eq 'Set' && $txn->Field eq 'Status');
>
> if ($txn->NewValue eq "resolved") {
>
>    eval {$FirstRefersToTicketLink->TargetURI->URI};
>    my $results = $@;
>    $RT::Logger->info('219 - ' . $results);
>    if ($results =~ qr{^Can't call method}) {
>       $RT::Logger->info('UNDEFINED');
>       $returncode = 1;
>    } else {
>       $returncode = 0;
>    };
>
> };
>
> $RT::Logger->info('Return Code: ' . $returncode);
> return $returncode;
> --
> RT Training - Boston, September 9-10
> http://bestpractical.com/training
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140803/c895051f/attachment.htm>


More information about the rt-users mailing list