One requirement for RT notifications

Hello All,

I need to implement a request my users have raised regarding RT.
These are mainly to do with scrips, templates and display.
My RT instance has been running so smoothly that my grasp of these
things has somehow faded :wink:

I have been asked to modify RT to achieve the following:

  1. Whenever a ticket is assigned to a user by our RT mistress, the new
    owner is notified by e-mail. However, the new owners would like the
    contents of the ticket within the notification mail. Currently, they
    receive something like this:

From: JohnDoe via RT XXXX@wananchi.com
To: wash@wananchi.com
Date: Wed, 18 Oct 2006 15:28:43 +0300
Subject: [domain.tld #49113] Else Thing Some Subject

Wed Oct 18 15:28:42 2006: Request 9113 was acted upon.
Transaction: Given to wash by JohnDoe
Queue: info
Subject: Else Thing Some Subject
Owner: wash
Requestors: customer@domain.tld
Status: open
Ticket <URL: http://rt.wananchi.com/Ticket/Display.html?id=49113 >

This transaction appears to have no content

My scrip for this is:

On Owner Change Notify Owner with template Transaction

My “Transaction” template has a last line: {$Transaction->Content()}

Q: Why could it be failing to pull the ticket content?

    cheers
   - wash 

Odhiambo Washington . WANANCHI ONLINE LTD (Nairobi, KE) |
wash () WANANCHI ! com . 1ere Etage, Loita Hse, Loita St., |
GSM: (+254) 722 743 223 . # 10286, 00100 NAIROBI |
GSM: (+254) 733 744 121 . (+254) 020 313 985 - 9 |
“Oh My God! They killed init! You Bastards!”
–from a /. post

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Odhiambo WASHINGTON wrote:

  • On 22/10/06 12:54 -0400, Barry L. Kline wrote:
    | -----BEGIN PGP SIGNED MESSAGE-----
    | Hash: SHA1
    |
    | Odhiambo Washington wrote:
    | > Hello All,
    | >
    | > I need to implement a request my users have raised regarding RT.
    | > These are mainly to do with scrips, templates and display.
    | > My RT instance has been running so smoothly that my grasp of these
    | > things has somehow faded :wink:
    | >
    | [snip]
    | >
    | > This transaction appears to have no content
    | >
    | >
    | >
    | > My scrip for this is:
    | >
    | > On Owner Change Notify Owner with template Transaction
    | >
    | > My “Transaction” template has a last line: {$Transaction->Content()}
    | >
    | >
    | > Q: Why could it be failing to pull the ticket content?
    |
    | I’m no expert, but I believe it’s because the $Transaction object refers
    | to the transaction where the owner was changed. The Content() of this
    | transaction is empty. What you need to do is retrieve the ticket object
    | that this transaction refers to and pull its content.

Hi Barry,

Your explanation seems very correct!
Do you have any pointers how I can achieve that though?

I’m afraid not. As I said, I’m no expert on this. You can find out
some more by studying the various templates in the software itself, or
by looking at the wiki: http://wiki.bestpractical.com

Barr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFFO/fpCFu3bIiwtTARAkOIAJwPxkaBnRuQT46Y4qjdsslzVn+HtQCfd9dS
HrekJEPylKlo/f426axL7NI=
=z+lp
-----END PGP SIGNATURE-----

Odhiambo;
This been discussed few times before, and its on the wiki (but it
appears the wiki been attacked again) …
To add the initial request to the mail message what you need is to
change the Transaction template to something similar to:

RT-Attach-Message: yes

This is an admin correspondence:
{$RT::WebURL}Ticket/Display.html?id={$Ticket->id}

{$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
Transaction: {$Transaction->Description}
Queue: {$Ticket->QueueObj->Name}
given)"}
Owner: {$Ticket->OwnerObj->Name}
Ticket Queue = {$Ticket->QueueObj->Name}
Requestors: {$Ticket->RequestorAddresses}
Status: {$Ticket->Status}
Ticket <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >

This ticket is now assigned to {$Ticket->OwnerObj->Name}
The initial request was:
{
my $cont = ‘’;
my $trans = $Ticket->Transactions;
$trans->Limit(FIELD => ‘Type’, VALUE => ‘Create’);
while (my $tran = $trans->Next) {
my $attach = $tran->Attachments;
while (my $msg = $attach->Next){
next unless $msg->ContentType =~ m!^(text/plain|message|text$)!i;
my $content = $msg->Content;
next unless $content;
next if $cont eq $content;
$cont = $content;
my $wrapper = Text::Wrapper->new(columns=>70);
$cont = $wrapper->wrap($cont);
}
}
$cont ;
}

Barry L. Kline wrote:

Hi Roy,

Thank you so much for this valuable clue.

Before I posted this question, I had thoroughly scoured the wiki for
clues, because I do remember seeing such a discussion, but I just could
not find it!
Perhaps there is something Jesse will do to secure the wiki.

  • On 23/10/06 10:53 +0100, Roy El-Hames wrote:
    | Odhiambo;
    | This been discussed few times before, and its on the wiki (but it
    | appears the wiki been attacked again) …
    | To add the initial request to the mail message what you need is to
    | change the Transaction template to something similar to:
    |
    | RT-Attach-Message: yes
    |
    |
    | This is an admin correspondence:
    | {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
    |
    | {$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
    | Transaction: {$Transaction->Description}
    | Queue: {$Ticket->QueueObj->Name}
    | Subject: {$Transaction->Subject || $Ticket->Subject || “(No subject
    | given)”}
    | Owner: {$Ticket->OwnerObj->Name}
    | Ticket Queue = {$Ticket->QueueObj->Name}
    | Requestors: {$Ticket->RequestorAddresses}
    | Status: {$Ticket->Status}
    | Ticket <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
    |
    |
    | This ticket is now assigned to {$Ticket->OwnerObj->Name}
    | =============================================
    | The initial request was:
    | ====
    | {
    | my $cont = ‘’;
    | my $trans = $Ticket->Transactions;
    | $trans->Limit(FIELD => ‘Type’, VALUE => ‘Create’);
    | while (my $tran = $trans->Next) {
    | my $attach = $tran->Attachments;
    | while (my $msg = $attach->Next){
    | next unless $msg->ContentType =~ m!^(text/plain|message|text$)!i;
    | my $content = $msg->Content;
    | next unless $content;
    | next if $cont eq $content;
    | $cont = $content;
    | my $wrapper = Text::Wrapper->new(columns=>70);
    | $cont = $wrapper->wrap($cont);
    | }
    | }
    | $cont ;
    | }
    | =============================================
    |
    | Barry L. Kline wrote:
    | >-----BEGIN PGP SIGNED MESSAGE-----
    | >Hash: SHA1
    | >
    | >Odhiambo WASHINGTON wrote:
    | >
    | >>* On 22/10/06 12:54 -0400, Barry L. Kline wrote:
    | >>| -----BEGIN PGP SIGNED MESSAGE-----
    | >>| Hash: SHA1
    | >>|
    | >>| Odhiambo Washington wrote:
    | >>| > Hello All,
    | >>| >
    | >>| > I need to implement a request my users have raised regarding RT.
    | >>| > These are mainly to do with scrips, templates and display.
    | >>| > My RT instance has been running so smoothly that my grasp of these
    | >>| > things has somehow faded :wink:
    | >>| >
    | >>| [snip]
    | >>| >
    | >>| > This transaction appears to have no content
    | >>| >
    | >>| >
    | >>| >
    | >>| > My scrip for this is:
    | >>| >
    | >>| > On Owner Change Notify Owner with template Transaction
    | >>| >
    | >>| > My “Transaction” template has a last line: {$Transaction->Content()}
    | >>| >
    | >>| >
    | >>| > Q: Why could it be failing to pull the ticket content?
    | >>|
    | >>| I’m no expert, but I believe it’s because the $Transaction object refers
    | >>| to the transaction where the owner was changed. The Content() of this
    | >>| transaction is empty. What you need to do is retrieve the ticket object
    | >>| that this transaction refers to and pull its content.
    | >>
    | >>
    | >>Hi Barry,
    | >>
    | >>Your explanation seems very correct!
    | >>Do you have any pointers how I can achieve that though?
    | >>
    | >>
    | >
    | >I’m afraid not. As I said, I’m no expert on this. You can find out
    | >some more by studying the various templates in the software itself, or
    | >by looking at the wiki: http://wiki.bestpractical.com
    | >
    | >Barr
    | >-----BEGIN PGP SIGNATURE-----
    | >Version: GnuPG v1.2.6 (GNU/Linux)
    | >
    | >iD8DBQFFO/fpCFu3bIiwtTARAkOIAJwPxkaBnRuQT46Y4qjdsslzVn+HtQCfd9dS
    | >HrekJEPylKlo/f426axL7NI=
    | >=z+lp
    | >-----END PGP SIGNATURE-----
    | >_______________________________________________
    | >The rt-users Archives
    | >
    | >Community help: http://wiki.bestpractical.com
    | >Commercial support: sales@bestpractical.com
    | >
    | >
    | >Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
    | >Buy a copy at http://rtbook.bestpractical.com
    | >
    | >

      cheers
     - wash 
    

Odhiambo Washington . WANANCHI ONLINE LTD (Nairobi, KE) |
wash () WANANCHI ! com . 1ere Etage, Loita Hse, Loita St., |
GSM: (+254) 722 743 223 . # 10286, 00100 NAIROBI |
GSM: (+254) 733 744 121 . (+254) 020 313 985 - 9 |
“Oh My God! They killed init! You Bastards!”
–from a /. post