<div>Just trying to peice together the workflow from the last few emails, sorry if I simplify it too much...</div>
<div> </div>
<div>- previous owner comments on ticket with attachments</div>
<div>- somehow the owner changes(sounds like the previous owner may do this... not sure though)</div>
<div>- email fires to new owner notifying him he owns this ticket</div>
<div>- new owner uses email to communicate with requestor</div>
<div> </div>
<div>Your end state is </div>
<div>- owner changed</div>
<div>- requestor gets attachments</div>
<div>- new owner has a conduit to communicate to requestor via email</div>
<div> </div>
<div>The last part of that workflow makes me assume you have a scrip that notifies requestor on correspondence, so to me, the only thing that you need to do to get your end state, make the previous owner add the attachments as a correspondence instead of comment.</div>

<div> </div>
<div>If your end state also requires the new owner to have a copy of the attachments in his email, the previous owner can do a 1 time cc to the new owner when he's sending the reply with the attachments. </div>
<div> </div>
<div>If typing in the new owner's email address isn't reliable, there is an extension out there that does autocomplete, might be of some use? I've only looked at it once... not sure if it can be configured out of the box to do what you need, but it would be a starting point.</div>

<div>  </div>
<div>Not sure if you can get the attachments from a previous transaction, but a little user training may make it so you don't have to.</div>
<div> </div>
<div>Thanks!</div>
<div>Mike.<br></div>
<div class="gmail_quote">On Tue, Jul 5, 2011 at 6:33 PM, Mauricio Tavares <span dir="ltr"><<a href="mailto:raubvogel@gmail.com">raubvogel@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="im">On Tue, Jul 5, 2011 at 6:25 PM, Kenneth Crocker <<a href="mailto:kfcrocker@lbl.gov">kfcrocker@lbl.gov</a>> wrote:<br>> Mauricio,<br>><br></div>
<div class="im">> Why not just keep it simple and send them an email with some simple ticket<br>> info and the ticket id so they can just link to the ticket and see whatever<br>> info they need. They are going to need to go into the ticket anyway.<br>
> Clicking a link to the ticket won't take anymore time than clicking any<br>> attachment in the email. AND if the ticket has several attachments (as many<br>> of ours do), this simplifies the process a great deal.<br>
><br></div>     I agree; I actually have that working (well the text part of the<br>comment is shown on the ticket and then the non-text attachments are<br>provided as links). Problem is that is what they want is the new<br>
ticket owner to get a complete copy of the last ticket correspondence<br>so he can reply to it and it will be sent to the requestor. New owner<br>should not need to go to the RT web interface to do that. And that has<br>turned out to be a bit more challenging than I originally expected. :)<br>

<div>
<div></div>
<div class="h5"><br>> Just a thought.<br>><br>> Kenn<br>><br>> On Tue, Jul 5, 2011 at 3:01 PM, Mauricio Tavares <<a href="mailto:raubvogel@gmail.com">raubvogel@gmail.com</a>><br>> wrote:<br>>><br>
>> On Tue, Jul 5, 2011 at 5:55 PM, Mauricio Tavares <<a href="mailto:raubvogel@gmail.com">raubvogel@gmail.com</a>><br>>> wrote:<br>>> > On Tue, Jul 5, 2011 at 5:51 PM, Kenneth Crocker <<a href="mailto:kfcrocker@lbl.gov">kfcrocker@lbl.gov</a>><br>
>> > wrote:<br>>> >> Mauricio,<br>>> >><br>>> >> Who are you sending the email to?<br>>> >><br>>> >   The new ticket owner.<br>>> ><br>>>      Something on these lines (not claiming to be proper or correct)<br>
>> is what I am trying to do:<br>>><br>>> {<br>>>   my $Transactions = $Ticket->Transactions;<br>>>   $RT::Logger->debug("Find Transaction");<br>>>   $Transactions->Limit( FIELD => 'Type',<br>
>>                          VALUE => "Correspond"<br>>>                        );<br>>>   $Transaction = $Transactions->Last;<br>>>   $RT::Logger->debug("Found Transaction : $Transaction");<br>
>> }To: { $Ticket->OwnerObj->EmailAddress }<br>>> Subject: { $Ticket->Subject() }<br>>> RT-Attach-Message: yes<br>>><br>>> But I am not able to feed the $Transaction I want (the one I got above<br>
>> the headers) to RT-Attach-Message.<br>>><br>>> >> Kenn<br>>> >> LBNL<br>>> >><br>>> >> On Tue, Jul 5, 2011 at 12:35 PM, Mauricio Tavares <<a href="mailto:raubvogel@gmail.com">raubvogel@gmail.com</a>><br>
>> >> wrote:<br>>> >>><br>>> >>> On Tue, Jul 5, 2011 at 2:31 PM, Kenneth Crocker <<a href="mailto:kfcrocker@lbl.gov">kfcrocker@lbl.gov</a>><br>>> >>> wrote:<br>
>> >>> > Mauricio,<br>>> >>> ><br>>> >>> > What is it you want to do? It sounds like you want to put the last<br>>> >>> > correspondence of a ticket into an email/template when the owner of<br>
>> >>> > a<br>>> >>> > ticket<br>>> >>> > is changed. Is that right? Technically, there WAS a transaction<br>>> >>> > record<br>>> >>> > created, but since it only involved an owner change, that's the only<br>
>> >>> > info on<br>>> >>> > the transaction record.<br>>> >>> ><br>>> >>> > If this is what you want to do, it CAN be done fairly easily with a<br>>> >>> > scrip.<br>
>> >>> > What you want to do is pull up the last comment transaction entered<br>>> >>> > for<br>>> >>> > that<br>>> >>> > ticket. You can do that IN a template.<br>
>> >>> ><br>>> >>>      Well, this what I want do do:<br>>> >>><br>>> >>> If ticket owner changed<br>>> >>>   Send the last correspondence of a ticket into an email/template (as<br>
>> >>> correspondence) to the new ticket owner.<br>>> >>><br>>> >>> When I mean last correspondence I do want to include every attachment<br>>> >>> (.zip files, jpg, etc)  it came with (like what you would get by<br>
>> >>> having RT-Attach-Message: yes), not only the textual content (which is<br>>> >>> what you would get by doing $Transaction->Content).<br>>> >>><br>>> >>> From what I understand, $Transaction->Content (and RT-Attach-Message:<br>
>> >>> yes) need the last Transaction to be a correspondence type to do their<br>>> >>> magic. But since the transaction associated with owner changing does<br>>> >>> not generate a correspondence, I cannot use them as they are. Well, as<br>
>> >>> you pointed out, getting the text part of the last correspondence and<br>>> >>> creating a correspondence with that as the content is, quite easy. The<br>>> >>> non-text attachments are causing me problems.<br>
>> >>><br>>> >>> In my test script I grabbed only the transactions in that ticket with<br>>> >>> correspondence in them and am able to see which attachments the last<br>>> >>> correspondence had. That really does not do me any good but at least<br>
>> >>> made me feel happy that I was able to find the attachments. :)<br>>> >>><br>>> >>> > Hope this helps.<br>>> >>> ><br>>> >>> > Kenn<br>
>> >>> > LBNL<br>>> >>> ><br>>> >>> > On Thu, Jun 30, 2011 at 2:59 PM, Mauricio Tavares<br>>> >>> > <<a href="mailto:raubvogel@gmail.com">raubvogel@gmail.com</a>><br>
>> >>> > wrote:<br>>> >>> >><br>>> >>> >>      From what I understand (thanks trs), in an on Owner Change<br>>> >>> >> event<br>>> >>> >> you cannot rely on using {$Transaction->Content()} to copy the last<br>
>> >>> >> message/correspondence in a given ticket because no transaction was<br>>> >>> >> created. So, how can you fake it in an template? If the content was<br>>> >>> >> only a text file, it is not hard to do it, but what happens when<br>
>> >>> >> you<br>>> >>> >> also have attachments? I wrote the following template,<br>>> >>> >><br>>> >>> >> {<br>>> >>> >>   my $thingie = "Attachments:";<br>
>> >>> >>   my $Transactions = $Ticket->Transactions;<br>>> >>> >><br>>> >>> >>   $Transactions->Limit( FIELD => 'Type',<br>>> >>> >>                           VALUE => "Correspond"<br>
>> >>> >>                         );<br>>> >>> >>   # $Rt::Logger->debug("Find Transaction");<br>>> >>> >>   my $TransactionObj = $Transactions->Last;<br>
>> >>> >>      my $AttachmentsObj =<br>>> >>> >> RT::Attachments->new($TransactionObj->CurrentUser);<br>>> >>> >>      $AttachmentsObj->Limit( FIELD => 'TransactionID',<br>
>> >>> >>                              VALUE => $TransactionObj->id<br>>> >>> >>                            );<br>>> >>> >>      while ( my $a = $AttachmentsObj->Next ) {<br>
>> >>> >>         $thingie .= "\nFound an attachment with encoding " .<br>>> >>> >> $a->ContentType . " and ID " . $a->id;<br>>> >>> >>         if ( $a->ContentType eq 'text/plain' || $a->ContentType eq<br>
>> >>> >> 'text/html'){<br>>> >>> >>            $thingie .= "\nContent:\n" . $a->Content;<br>>> >>> >>         }<br>>> >>> >>         elseif ( $a->ContentType eq 'multipart/mixed') {<br>
>> >>> >>         }<br>>> >>> >>         else {<br>>> >>> >>            $thingie .= "\n" . $RT::WebURL ."/Ticket/Attachment/".<br>>> >>> >> $a->TransactionId ."/". $a->id ."/". $a->Filename;<br>
>> >>> >>            $thingie .= "\n    ";<br>>> >>> >>         }<br>>> >>> >>      }<br>>> >>> >>   $thingie;<br>>> >>> >> }<br>
>> >>> >><br>>> >>> >> which finds the attachments and put links for the non-text (from<br>>> >>> >> <a href="http://requesttracker.wikia.com/wiki/AddAttachmentLinksToMail" target="_blank">http://requesttracker.wikia.com/wiki/AddAttachmentLinksToMail</a>)<br>
>> >>> >> attachments, but what I really want is, well, emulate<br>>> >>> >> {$Transaction->Content()}. Would anyone have any pointers?<br>>> >>> >><br>>> >>> >> --------<br>
>> >>> >> 2011 Training: <a href="http://bestpractical.com/services/training.html" target="_blank">http://bestpractical.com/services/training.html</a><br>>> >>> ><br>>> >>> ><br>
>> >>> ><br>>> >>> > --------<br>>> >>> > 2011 Training: <a href="http://bestpractical.com/services/training.html" target="_blank">http://bestpractical.com/services/training.html</a><br>
>> >>> ><br>>> >><br>>> >><br>>> >><br>>> >> --------<br>>> >> 2011 Training: <a href="http://bestpractical.com/services/training.html" target="_blank">http://bestpractical.com/services/training.html</a><br>
>> >><br>>> ><br>><br>><br>><br>> --------<br>> 2011 Training: <a href="http://bestpractical.com/services/training.html" target="_blank">http://bestpractical.com/services/training.html</a><br>
><br><br>--------<br>2011 Training: <a href="http://bestpractical.com/services/training.html" target="_blank">http://bestpractical.com/services/training.html</a><br></div></div></blockquote></div><br><br clear="all"><br>
-- <br>Mike Johnson<br>Datatel Programmer/Analyst<br>Northern Ontario School of Medicine<br>955 Oliver Road<br>Thunder Bay, ON   P7B 5E1<br>Phone: (807) 766-7331<br>Email: <a href="mailto:mike.johnson@nosm.ca">mike.johnson@nosm.ca</a><br>