Faking {$Transaction->Content()}

From what I understand (thanks trs), in an on Owner Change event
you cannot rely on using {$Transaction->Content()} to copy the last
message/correspondence in a given ticket because no transaction was
created. So, how can you fake it in an template? If the content was
only a text file, it is not hard to do it, but what happens when you
also have attachments? I wrote the following template,

{
my $thingie = “Attachments:”;
my $Transactions = $Ticket->Transactions;

$Transactions->Limit( FIELD => ‘Type’,
VALUE => “Correspond”
);

$Rt::Logger->debug(“Find Transaction”);

my $TransactionObj = $Transactions->Last;
my $AttachmentsObj = RT::Attachments->new($TransactionObj->CurrentUser);
$AttachmentsObj->Limit( FIELD => ‘TransactionID’,
VALUE => $TransactionObj->id
);
while ( my $a = $AttachmentsObj->Next ) {
$thingie .= “\nFound an attachment with encoding " .
$a->ContentType . " and ID " . $a->id;
if ( $a->ContentType eq ‘text/plain’ || $a->ContentType eq
’text/html’){
$thingie .= “\nContent:\n” . $a->Content;
}
elseif ( $a->ContentType eq ‘multipart/mixed’) {
}
else {
$thingie .= “\n” . $RT::WebURL .”/Ticket/Attachment/".
$a->TransactionId ."/". $a->id ."/". $a->Filename;
$thingie .= "\n ";
}
}
$thingie;
}

which finds the attachments and put links for the non-text (from
http://requesttracker.wikia.com/wiki/AddAttachmentLinksToMail)
attachments, but what I really want is, well, emulate
{$Transaction->Content()}. Would anyone have any pointers?

Mauricio,

What is it you want to do? It sounds like you want to put the last
correspondence of a ticket into an email/template when the owner of a ticket
is changed. Is that right? Technically, there WAS a transaction record
created, but since it only involved an owner change, that’s the only info on
the transaction record.

If this is what you want to do, it CAN be done fairly easily with a scrip.
What you want to do is pull up the last comment transaction entered for
that ticket. You can do that IN a template.

Hope this helps.

Kenn
LBNLOn Thu, Jun 30, 2011 at 2:59 PM, Mauricio Tavares raubvogel@gmail.comwrote:

 From what I understand (thanks trs), in an on Owner Change event

you cannot rely on using {$Transaction->Content()} to copy the last
message/correspondence in a given ticket because no transaction was
created. So, how can you fake it in an template? If the content was
only a text file, it is not hard to do it, but what happens when you
also have attachments? I wrote the following template,

{
my $thingie = “Attachments:”;
my $Transactions = $Ticket->Transactions;

$Transactions->Limit( FIELD => ‘Type’,
VALUE => “Correspond”
);

$Rt::Logger->debug(“Find Transaction”);

my $TransactionObj = $Transactions->Last;
my $AttachmentsObj =
RT::Attachments->new($TransactionObj->CurrentUser);
$AttachmentsObj->Limit( FIELD => ‘TransactionID’,
VALUE => $TransactionObj->id
);
while ( my $a = $AttachmentsObj->Next ) {
$thingie .= “\nFound an attachment with encoding " .
$a->ContentType . " and ID " . $a->id;
if ( $a->ContentType eq ‘text/plain’ || $a->ContentType eq
’text/html’){
$thingie .= “\nContent:\n” . $a->Content;
}
elseif ( $a->ContentType eq ‘multipart/mixed’) {
}
else {
$thingie .= “\n” . $RT::WebURL .”/Ticket/Attachment/".
$a->TransactionId ."/". $a->id ."/". $a->Filename;
$thingie .= "\n ";
}
}
$thingie;
}

which finds the attachments and put links for the non-text (from
http://requesttracker.wikia.com/wiki/AddAttachmentLinksToMail)
attachments, but what I really want is, well, emulate
{$Transaction->Content()}. Would anyone have any pointers?


2011 Training: http://bestpractical.com/services/training.html

Mauricio,

What is it you want to do? It sounds like you want to put the last
correspondence of a ticket into an email/template when the owner of a ticket
is changed. Is that right? Technically, there WAS a transaction record
created, but since it only involved an owner change, that’s the only info on
the transaction record.

If this is what you want to do, it CAN be done fairly easily with a scrip.
What you want to do is pull up the last comment transaction entered for that
ticket. You can do that IN a template.

  Well, this what I want do do:

If ticket owner changed
Send the last correspondence of a ticket into an email/template (as
correspondence) to the new ticket owner.

When I mean last correspondence I do want to include every attachment
(.zip files, jpg, etc) it came with (like what you would get by
having RT-Attach-Message: yes), not only the textual content (which is
what you would get by doing $Transaction->Content).

From what I understand, $Transaction->Content (and RT-Attach-Message:
yes) need the last Transaction to be a correspondence type to do their
magic. But since the transaction associated with owner changing does
not generate a correspondence, I cannot use them as they are. Well, as
you pointed out, getting the text part of the last correspondence and
creating a correspondence with that as the content is, quite easy. The
non-text attachments are causing me problems.

In my test script I grabbed only the transactions in that ticket with
correspondence in them and am able to see which attachments the last
correspondence had. That really does not do me any good but at least
made me feel happy that I was able to find the attachments. :slight_smile:

Mauricio,

Who are you sending the email to?

Kenn
LBNLOn Tue, Jul 5, 2011 at 12:35 PM, Mauricio Tavares raubvogel@gmail.comwrote:

On Tue, Jul 5, 2011 at 2:31 PM, Kenneth Crocker kfcrocker@lbl.gov wrote:

Mauricio,

What is it you want to do? It sounds like you want to put the last
correspondence of a ticket into an email/template when the owner of a
ticket
is changed. Is that right? Technically, there WAS a transaction record
created, but since it only involved an owner change, that’s the only info
on
the transaction record.

If this is what you want to do, it CAN be done fairly easily with a
scrip.
What you want to do is pull up the last comment transaction entered for
that
ticket. You can do that IN a template.

  Well, this what I want do do:

If ticket owner changed
Send the last correspondence of a ticket into an email/template (as
correspondence) to the new ticket owner.

When I mean last correspondence I do want to include every attachment
(.zip files, jpg, etc) it came with (like what you would get by
having RT-Attach-Message: yes), not only the textual content (which is
what you would get by doing $Transaction->Content).

From what I understand, $Transaction->Content (and RT-Attach-Message:
yes) need the last Transaction to be a correspondence type to do their
magic. But since the transaction associated with owner changing does
not generate a correspondence, I cannot use them as they are. Well, as
you pointed out, getting the text part of the last correspondence and
creating a correspondence with that as the content is, quite easy. The
non-text attachments are causing me problems.

In my test script I grabbed only the transactions in that ticket with
correspondence in them and am able to see which attachments the last
correspondence had. That really does not do me any good but at least
made me feel happy that I was able to find the attachments. :slight_smile:

Hope this helps.

Kenn
LBNL

On Thu, Jun 30, 2011 at 2:59 PM, Mauricio Tavares raubvogel@gmail.com wrote:

 From what I understand (thanks trs), in an on Owner Change event

you cannot rely on using {$Transaction->Content()} to copy the last
message/correspondence in a given ticket because no transaction was
created. So, how can you fake it in an template? If the content was
only a text file, it is not hard to do it, but what happens when you
also have attachments? I wrote the following template,

{
my $thingie = “Attachments:”;
my $Transactions = $Ticket->Transactions;

$Transactions->Limit( FIELD => ‘Type’,
VALUE => “Correspond”
);

$Rt::Logger->debug(“Find Transaction”);

my $TransactionObj = $Transactions->Last;
my $AttachmentsObj =
RT::Attachments->new($TransactionObj->CurrentUser);
$AttachmentsObj->Limit( FIELD => ‘TransactionID’,
VALUE => $TransactionObj->id
);
while ( my $a = $AttachmentsObj->Next ) {
$thingie .= “\nFound an attachment with encoding " .
$a->ContentType . " and ID " . $a->id;
if ( $a->ContentType eq ‘text/plain’ || $a->ContentType eq
’text/html’){
$thingie .= “\nContent:\n” . $a->Content;
}
elseif ( $a->ContentType eq ‘multipart/mixed’) {
}
else {
$thingie .= “\n” . $RT::WebURL .”/Ticket/Attachment/".
$a->TransactionId ."/". $a->id ."/". $a->Filename;
$thingie .= "\n ";
}
}
$thingie;
}

which finds the attachments and put links for the non-text (from
http://requesttracker.wikia.com/wiki/AddAttachmentLinksToMail)
attachments, but what I really want is, well, emulate
{$Transaction->Content()}. Would anyone have any pointers?


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html

Mauricio,

Who are you sending the email to?

The new ticket owner.

Mauricio,

Why not just keep it simple and send them an email with some simple ticket
info and the ticket id so they can just link to the ticket and see whatever
info they need. They are going to need to go into the ticket anyway.
Clicking a link to the ticket won’t take anymore time than clicking any
attachment in the email. AND if the ticket has several attachments (as many
of ours do), this simplifies the process a great deal.

Just a thought.

KennOn Tue, Jul 5, 2011 at 3:01 PM, Mauricio Tavares raubvogel@gmail.comwrote:

On Tue, Jul 5, 2011 at 5:55 PM, Mauricio Tavares raubvogel@gmail.com wrote:

On Tue, Jul 5, 2011 at 5:51 PM, Kenneth Crocker kfcrocker@lbl.gov wrote:

Mauricio,

Who are you sending the email to?

The new ticket owner.

  Something on these lines (not claiming to be proper or correct)

is what I am trying to do:

{
my $Transactions = $Ticket->Transactions;
$RT::Logger->debug(“Find Transaction”);
$Transactions->Limit( FIELD => ‘Type’,
VALUE => “Correspond”
);
$Transaction = $Transactions->Last;
$RT::Logger->debug(“Found Transaction : $Transaction”);
}To: { $Ticket->OwnerObj->EmailAddress }
Subject: { $Ticket->Subject() }
RT-Attach-Message: yes

But I am not able to feed the $Transaction I want (the one I got above
the headers) to RT-Attach-Message.

Kenn
LBNL

On Tue, Jul 5, 2011 at 12:35 PM, Mauricio Tavares raubvogel@gmail.com wrote:

On Tue, Jul 5, 2011 at 2:31 PM, Kenneth Crocker kfcrocker@lbl.gov wrote:

Mauricio,

What is it you want to do? It sounds like you want to put the last
correspondence of a ticket into an email/template when the owner of a
ticket
is changed. Is that right? Technically, there WAS a transaction
record

created, but since it only involved an owner change, that’s the only
info on
the transaction record.

If this is what you want to do, it CAN be done fairly easily with a
scrip.
What you want to do is pull up the last comment transaction entered
for

that
ticket. You can do that IN a template.

 Well, this what I want do do:

If ticket owner changed
Send the last correspondence of a ticket into an email/template (as
correspondence) to the new ticket owner.

When I mean last correspondence I do want to include every attachment
(.zip files, jpg, etc) it came with (like what you would get by
having RT-Attach-Message: yes), not only the textual content (which is
what you would get by doing $Transaction->Content).

From what I understand, $Transaction->Content (and RT-Attach-Message:
yes) need the last Transaction to be a correspondence type to do their
magic. But since the transaction associated with owner changing does
not generate a correspondence, I cannot use them as they are. Well, as
you pointed out, getting the text part of the last correspondence and
creating a correspondence with that as the content is, quite easy. The
non-text attachments are causing me problems.

In my test script I grabbed only the transactions in that ticket with
correspondence in them and am able to see which attachments the last
correspondence had. That really does not do me any good but at least
made me feel happy that I was able to find the attachments. :slight_smile:

Hope this helps.

Kenn
LBNL

On Thu, Jun 30, 2011 at 2:59 PM, Mauricio Tavares < raubvogel@gmail.com> wrote:

 From what I understand (thanks trs), in an on Owner Change

event

you cannot rely on using {$Transaction->Content()} to copy the last
message/correspondence in a given ticket because no transaction was
created. So, how can you fake it in an template? If the content was
only a text file, it is not hard to do it, but what happens when you
also have attachments? I wrote the following template,

{
my $thingie = “Attachments:”;
my $Transactions = $Ticket->Transactions;

$Transactions->Limit( FIELD => ‘Type’,
VALUE => “Correspond”
);

$Rt::Logger->debug(“Find Transaction”);

my $TransactionObj = $Transactions->Last;
my $AttachmentsObj =
RT::Attachments->new($TransactionObj->CurrentUser);
$AttachmentsObj->Limit( FIELD => ‘TransactionID’,
VALUE => $TransactionObj->id
);
while ( my $a = $AttachmentsObj->Next ) {
$thingie .= “\nFound an attachment with encoding " .
$a->ContentType . " and ID " . $a->id;
if ( $a->ContentType eq ‘text/plain’ || $a->ContentType eq
’text/html’){
$thingie .= “\nContent:\n” . $a->Content;
}
elseif ( $a->ContentType eq ‘multipart/mixed’) {
}
else {
$thingie .= “\n” . $RT::WebURL .”/Ticket/Attachment/".
$a->TransactionId ."/". $a->id ."/". $a->Filename;
$thingie .= "\n ";
}
}
$thingie;
}

which finds the attachments and put links for the non-text (from
http://requesttracker.wikia.com/wiki/AddAttachmentLinksToMail)
attachments, but what I really want is, well, emulate
{$Transaction->Content()}. Would anyone have any pointers?


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html

Mauricio,

Why not just keep it simple and send them an email with some simple ticket
info and the ticket id so they can just link to the ticket and see whatever
info they need. They are going to need to go into the ticket anyway.
Clicking a link to the ticket won’t take anymore time than clicking any
attachment in the email. AND if the ticket has several attachments (as many
of ours do), this simplifies the process a great deal.

  I agree; I actually have that working (well the text part of the

comment is shown on the ticket and then the non-text attachments are
provided as links). Problem is that is what they want is the new
ticket owner to get a complete copy of the last ticket correspondence
so he can reply to it and it will be sent to the requestor. New owner
should not need to go to the RT web interface to do that. And that has
turned out to be a bit more challenging than I originally expected. :slight_smile:

Just trying to peice together the workflow from the last few emails, sorry
if I simplify it too much…

  • previous owner comments on ticket with attachments
  • somehow the owner changes(sounds like the previous owner may do this…
    not sure though)
  • email fires to new owner notifying him he owns this ticket
  • new owner uses email to communicate with requestor

Your end state is

  • owner changed
  • requestor gets attachments
  • new owner has a conduit to communicate to requestor via email

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.

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.

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.

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.

Thanks!
Mike.On Tue, Jul 5, 2011 at 6:33 PM, Mauricio Tavares raubvogel@gmail.comwrote:

On Tue, Jul 5, 2011 at 6:25 PM, Kenneth Crocker kfcrocker@lbl.gov wrote:

Mauricio,

Why not just keep it simple and send them an email with some simple
ticket
info and the ticket id so they can just link to the ticket and see
whatever
info they need. They are going to need to go into the ticket anyway.
Clicking a link to the ticket won’t take anymore time than clicking any
attachment in the email. AND if the ticket has several attachments (as
many
of ours do), this simplifies the process a great deal.

 I agree; I actually have that working (well the text part of the

comment is shown on the ticket and then the non-text attachments are
provided as links). Problem is that is what they want is the new
ticket owner to get a complete copy of the last ticket correspondence
so he can reply to it and it will be sent to the requestor. New owner
should not need to go to the RT web interface to do that. And that has
turned out to be a bit more challenging than I originally expected. :slight_smile:

Just a thought.

Kenn

On Tue, Jul 5, 2011 at 3:01 PM, Mauricio Tavares raubvogel@gmail.com wrote:

On Tue, Jul 5, 2011 at 5:55 PM, Mauricio Tavares raubvogel@gmail.com wrote:

On Tue, Jul 5, 2011 at 5:51 PM, Kenneth Crocker kfcrocker@lbl.gov wrote:

Mauricio,

Who are you sending the email to?

The new ticket owner.

 Something on these lines (not claiming to be proper or correct)

is what I am trying to do:

{
my $Transactions = $Ticket->Transactions;
$RT::Logger->debug(“Find Transaction”);
$Transactions->Limit( FIELD => ‘Type’,
VALUE => “Correspond”
);
$Transaction = $Transactions->Last;
$RT::Logger->debug(“Found Transaction : $Transaction”);
}To: { $Ticket->OwnerObj->EmailAddress }
Subject: { $Ticket->Subject() }
RT-Attach-Message: yes

But I am not able to feed the $Transaction I want (the one I got above
the headers) to RT-Attach-Message.

Kenn
LBNL

On Tue, Jul 5, 2011 at 12:35 PM, Mauricio Tavares < raubvogel@gmail.com> wrote:

On Tue, Jul 5, 2011 at 2:31 PM, Kenneth Crocker kfcrocker@lbl.gov wrote:

Mauricio,

What is it you want to do? It sounds like you want to put the last
correspondence of a ticket into an email/template when the owner
of

a
ticket
is changed. Is that right? Technically, there WAS a transaction
record
created, but since it only involved an owner change, that’s the
only

info on
the transaction record.

If this is what you want to do, it CAN be done fairly easily with
a

scrip.
What you want to do is pull up the last comment transaction
entered

for
that
ticket. You can do that IN a template.

 Well, this what I want do do:

If ticket owner changed
Send the last correspondence of a ticket into an email/template
(as

correspondence) to the new ticket owner.

When I mean last correspondence I do want to include every
attachment

(.zip files, jpg, etc) it came with (like what you would get by
having RT-Attach-Message: yes), not only the textual content (which
is

what you would get by doing $Transaction->Content).

From what I understand, $Transaction->Content (and
RT-Attach-Message:

yes) need the last Transaction to be a correspondence type to do
their

magic. But since the transaction associated with owner changing does
not generate a correspondence, I cannot use them as they are. Well,
as

you pointed out, getting the text part of the last correspondence
and

creating a correspondence with that as the content is, quite easy.
The

non-text attachments are causing me problems.

In my test script I grabbed only the transactions in that ticket
with

correspondence in them and am able to see which attachments the last
correspondence had. That really does not do me any good but at least
made me feel happy that I was able to find the attachments. :slight_smile:

Hope this helps.

Kenn
LBNL

On Thu, Jun 30, 2011 at 2:59 PM, Mauricio Tavares raubvogel@gmail.com wrote:

 From what I understand (thanks trs), in an on Owner Change

event
you cannot rely on using {$Transaction->Content()} to copy the
last

message/correspondence in a given ticket because no transaction
was

created. So, how can you fake it in an template? If the content
was

only a text file, it is not hard to do it, but what happens when
you
also have attachments? I wrote the following template,

{
my $thingie = “Attachments:”;
my $Transactions = $Ticket->Transactions;

$Transactions->Limit( FIELD => ‘Type’,
VALUE => “Correspond”
);

$Rt::Logger->debug(“Find Transaction”);

my $TransactionObj = $Transactions->Last;
my $AttachmentsObj =
RT::Attachments->new($TransactionObj->CurrentUser);
$AttachmentsObj->Limit( FIELD => ‘TransactionID’,
VALUE => $TransactionObj->id
);
while ( my $a = $AttachmentsObj->Next ) {
$thingie .= "\nFound an attachment with encoding " .
$a->ContentType . " and ID " . $a->id;
if ( $a->ContentType eq ‘text/plain’ || $a->ContentType
eq

‘text/html’){
$thingie .= “\nContent:\n” . $a->Content;
}
elseif ( $a->ContentType eq ‘multipart/mixed’) {
}
else {
$thingie .= “\n” . $RT::WebURL ."/Ticket/Attachment/".
$a->TransactionId ."/". $a->id ."/". $a->Filename;
$thingie .= "\n ";
}
}
$thingie;
}

which finds the attachments and put links for the non-text (from
http://requesttracker.wikia.com/wiki/AddAttachmentLinksToMail)
attachments, but what I really want is, well, emulate
{$Transaction->Content()}. Would anyone have any pointers?


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html

Mike Johnson
Datatel Programmer/Analyst
Northern Ontario School of Medicine
955 Oliver Road
Thunder Bay, ON P7B 5E1
Phone: (807) 766-7331
Email: mike.johnson@nosm.ca

Just trying to peice together the workflow from the last few emails, sorry
if I simplify it too much…

  • previous owner comments on ticket with attachments
  • somehow the owner changes(sounds like the previous owner may do this…
    not sure though)
  • email fires to new owner notifying him he owns this ticket
  • new owner uses email to communicate with requestor
  You got the workflow right. FYI, right now I am able to send an

email to new owner that looks like the last correspondence in the
ticket with two small exceptions:

o I created a header that indicates the new owner. Such header is only
sent to the AdminCcs, not to the requestor or other CCs. Owner can use
that header to filter out correspondence that is addressed to
him/her/it.

o Non-text attachments are shown as links instead of being attached to
the email being sent to the new owner. I would like to have them
attached but right now I do not know how to do it. I probably need to
learn how to create this email as a MIMEObj, which is my weakness
right now.

Your end state is

  • owner changed
  • requestor gets attachments
  • new owner has a conduit to communicate to requestor via email

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.

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.

  But that would mean old owner would have to (a) pass ownership

to new owner and (b) cc the new owner. That makes it easier for old
owner to miss a step.

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.

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.

  You should know by now it is easier to write code than to train users. ;)

Hi All,

We just upgraded our RT from 3.8.4 to 4.0.1We upgraded the database also.

When we want to create a new custom field we are getting the following errors

Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 620.

What could be the problem.

With Regards
Vinod.R

From: Mauricio Tavares raubvogel@gmail.com
To: Mike Johnson mike.johnson@nosm.ca
Cc: rt-users@lists.bestpractical.com
Sent: Thursday, July 7, 2011 10:40 AM
Subject: Re: [rt-users] Faking {$Transaction->Content()}

Just trying to peice together the workflow from the last few emails, sorry
if I simplify it too much…

  • previous owner comments on ticket with attachments
  • somehow the owner changes(sounds like the previous owner may do this…
    not sure though)
  • email fires to new owner notifying him he owns this ticket
  • new owner uses email to communicate with requestor
  You got the workflow right. FYI, right now I am able to send an

email to new owner that looks like the last correspondence in the
ticket with two small exceptions:

o I created a header that indicates the new owner. Such header is only
sent to the AdminCcs, not to the requestor or other CCs. Owner can use
that header to filter out correspondence that is addressed to
him/her/it.

o Non-text attachments are shown as links instead of being attached to
the email being sent to the new owner. I would like to have them
attached but right now I do not know how to do it. I probably need to
learn how to create this email as a MIMEObj, which is my weakness
right now.

Your end state is

  • owner changed
  • requestor gets attachments
  • new owner has a conduit to communicate to requestor via email

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.

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.

  But that would mean old owner would have to (a) pass ownership

to new owner and (b) cc the new owner. That makes it easier for old
owner to miss a step.

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.

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.

  You should know by now it is easier to write code than to train users. ;)

Thanks!
Mike.

Mauricio,

Why not just keep it simple and send them an email with some simple
ticket
info and the ticket id so they can just link to the ticket and see
whatever
info they need. They are going to need to go into the ticket anyway.
Clicking a link to the ticket won’t take anymore time than clicking any
attachment in the email. AND if the ticket has several attachments (as
many
of ours do), this simplifies the process a great deal.

 I agree; I actually have that working (well the text part of the

comment is shown on the ticket and then the non-text attachments are
provided as links). Problem is that is what they want is the new
ticket owner to get a complete copy of the last ticket correspondence
so he can reply to it and it will be sent to the requestor. New owner
should not need to go to the RT web interface to do that. And that has
turned out to be a bit more challenging than I originally expected. :slight_smile:

Just a thought.

Kenn

Mauricio,

Who are you sending the email to?

The new ticket owner.

 Something on these lines (not claiming to be proper or correct)

is what I am trying to do:

{
my $Transactions = $Ticket->Transactions;
$RT::Logger->debug(“Find Transaction”);
$Transactions->Limit( FIELD => ‘Type’,
VALUE => “Correspond”
);
$Transaction = $Transactions->Last;
$RT::Logger->debug(“Found Transaction : $Transaction”);
}To: { $Ticket->OwnerObj->EmailAddress }
Subject: { $Ticket->Subject() }
RT-Attach-Message: yes

But I am not able to feed the $Transaction I want (the one I got above
the headers) to RT-Attach-Message.

Kenn
LBNL

Mauricio,

What is it you want to do? It sounds like you want to put the
last
correspondence of a ticket into an email/template when the owner
of
a
ticket
is changed. Is that right? Technically, there WAS a transaction
record
created, but since it only involved an owner change, that’s the
only
info on
the transaction record.

If this is what you want to do, it CAN be done fairly easily with
a
scrip.
What you want to do is pull up the last comment transaction
entered
for
that
ticket. You can do that IN a template.

 Well, this what I want do do:

If ticket owner changed
Send the last correspondence of a ticket into an email/template
(as
correspondence) to the new ticket owner.

When I mean last correspondence I do want to include every
attachment
(.zip files, jpg, etc) it came with (like what you would get by
having RT-Attach-Message: yes), not only the textual content (which
is
what you would get by doing $Transaction->Content).

From what I understand, $Transaction->Content (and
RT-Attach-Message:
yes) need the last Transaction to be a correspondence type to do
their
magic. But since the transaction associated with owner changing
does
not generate a correspondence, I cannot use them as they are. Well,
as
you pointed out, getting the text part of the last correspondence
and
creating a correspondence with that as the content is, quite easy.
The
non-text attachments are causing me problems.

In my test script I grabbed only the transactions in that ticket
with
correspondence in them and am able to see which attachments the
last
correspondence had. That really does not do me any good but at
least
made me feel happy that I was able to find the attachments. :slight_smile:

Hope this helps.

Kenn
LBNL

 From what I understand (thanks trs), in an on Owner Change

event
you cannot rely on using {$Transaction->Content()} to copy the
last
message/correspondence in a given ticket because no transaction
was
created. So, how can you fake it in an template? If the content
was
only a text file, it is not hard to do it, but what happens when
you
also have attachments? I wrote the following template,

{
my $thingie = “Attachments:”;
my $Transactions = $Ticket->Transactions;

$Transactions->Limit( FIELD => ‘Type’,
VALUE => “Correspond”
);

$Rt::Logger->debug(“Find Transaction”);

my $TransactionObj = $Transactions->Last;
my $AttachmentsObj =
RT::Attachments->new($TransactionObj->CurrentUser);
$AttachmentsObj->Limit( FIELD => ‘TransactionID’,
VALUE => $TransactionObj->id
);
while ( my $a = $AttachmentsObj->Next ) {
$thingie .= “\nFound an attachment with encoding " .
$a->ContentType . " and ID " . $a->id;
if ( $a->ContentType eq ‘text/plain’ || $a->ContentType
eq
’text/html’){
$thingie .= “\nContent:\n” . $a->Content;
}
elseif ( $a->ContentType eq ‘multipart/mixed’) {
}
else {
$thingie .= “\n” . $RT::WebURL
.”/Ticket/Attachment/".
$a->TransactionId ."/". $a->id ."/". $a->Filename;
$thingie .= "\n ";
}
}
$thingie;
}

which finds the attachments and put links for the non-text (from
http://requesttracker.wikia.com/wiki/AddAttachmentLinksToMail)
attachments, but what I really want is, well, emulate
{$Transaction->Content()}. Would anyone have any pointers?


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html


Mike Johnson
Datatel Programmer/Analyst
Northern Ontario School of Medicine
955 Oliver Road
Thunder Bay, ON P7B 5E1
Phone: (807) 766-7331
Email: mike.johnson@nosm.ca


2011 Training: http://bestpractical.com/services/training.html

2011 Training: http://bestpractical.com/services/training.html

We just upgraded our RT from 3.8.4 to 4.0.1
We upgraded the database also.

When we want to create a new custom field we are getting the following errors

Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 620.

What could be the problem.

The most common failure for something like this is that you have a
CustomField_Overlay.pm left over from 3.8 and didn’t follow the
directions. Alternately, you might have a local customization or
extension that affects Custom Fields.

-kevin

Hi Kevin,

I deleted all *_Overlay.pm files when I upgraded and I have the following setting in RT_SiteConfig.pm
Set(@Plugins, qw(
RT::Authen::ExternalAuth
RT::Extension::CustomField::Checkbox
));

If I comment the above one I am getting the following error
could not find component for path ‘EditCustomFieldSelectCheckbox’

If I enable the above in RT_SiteConfig.pm I am getting the following error
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 620.

With Regards
Vinod.R

From: Kevin Falcone falcone@bestpractical.com
To: rt-users@lists.bestpractical.com
Sent: Thursday, July 7, 2011 12:46 PM
Subject: Re: [rt-users] Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.

We just upgraded our RT from 3.8.4 to 4.0.1
We upgraded the database also.

When we want to create a new custom field we are getting the following errors

Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 620.

What could be the problem.

The most common failure for something like this is that you have a
CustomField_Overlay.pm left over from 3.8 and didn’t follow the
directions. Alternately, you might have a local customization or
extension that affects Custom Fields.

-kevin

2011 Training: http://bestpractical.com/services/training.html

Hi Kevin,

I deleted all *_Overlay.pm files when I upgraded and I have the following setting in RT_SiteConfig.pm
Set(@Plugins, qw(
RT::Authen::ExternalAuth
RT::Extension::CustomField::Checkbox
));

Ah, there’s the problem.

RT-Extension-CustomField-Checkbox has been superseded by RT4 (and in
fact is really incompatible with RT4). Unfortunately, there isn’t
currently an upgrade script, although we’ll make sure this gets into
the bug tracker.

You should be able to do something like this in your development
environment.

Find the entry in your CustomFields table with the Checkbox entry,
update Type to Select and DisplayType to List.

-kevin

Hi Kevin,

Updated the database as you suggested.
Now on the form there are no radio button’s

With Regards
Vinod.RFrom: Kevin Falcone falcone@bestpractical.com
To: Direct Insure Online vinod.rapolu@yahoo.com
Sent: Thursday, July 7, 2011 4:31 PM
Subject: Re: [rt-users] Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.

Hi Kevin,

I deleted all *_Overlay.pm files when I upgraded and I have the following setting in RT_SiteConfig.pm
Set(@Plugins, qw(
RT::Authen::ExternalAuth
RT::Extension::CustomField::Checkbox
));

Ah, there’s the problem.

RT-Extension-CustomField-Checkbox has been superseded by RT4 (and in
fact is really incompatible with RT4). Unfortunately, there isn’t
currently an upgrade script, although we’ll make sure this gets into
the bug tracker.

You should be able to do something like this in your development
environment.

Find the entry in your CustomFields table with the Checkbox entry,
update Type to Select and DisplayType to List.

-kevin

If I comment the above one I am getting the following error
could not find component for path ‘EditCustomFieldSelectCheckbox’

If I enable the above in RT_SiteConfig.pm I am getting the following error
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 620.

With Regards
Vinod.R

From: Kevin Falcone falcone@bestpractical.com
To: rt-users@lists.bestpractical.com
Sent: Thursday, July 7, 2011 12:46 PM
Subject: Re: [rt-users] Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.

We just upgraded our RT from 3.8.4 to 4.0.1
We upgraded the database also.

When we want to create a new custom field we are getting the following errors

Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 620.

What could be the problem.

The most common failure for something like this is that you have a
CustomField_Overlay.pm left over from 3.8 and didn’t follow the
directions. Alternately, you might have a local customization or
extension that affects Custom Fields.

Hi,

Try the following SQL query that should help. I’m preparing a new
version of the extension to stop people from using it under RT4 and
help them upgrade. We’ll try to automate process in 4.0.2.

UPDATE CustomFields SET Type = 'Select' AND RenderType = 'List'
WHERE Type = 'SelectCheckbox';On Fri, Jul 8, 2011 at 12:38 AM, Kevin Falcone <falcone@bestpractical.com> wrote:

On Thu, Jul 07, 2011 at 01:01:27PM -0700, Direct Insure Online wrote:

Hi Kevin,

I deleted all *_Overlay.pm files when I upgraded and I have the following setting in RT_SiteConfig.pm
Set(@Plugins, qw(
RT::Authen::ExternalAuth
RT::Extension::CustomField::Checkbox
));

Ah, there’s the problem.

RT-Extension-CustomField-Checkbox has been superseded by RT4 (and in
fact is really incompatible with RT4). Unfortunately, there isn’t
currently an upgrade script, although we’ll make sure this gets into
the bug tracker.

You should be able to do something like this in your development
environment.

Find the entry in your CustomFields table with the Checkbox entry,
update Type to Select and DisplayType to List.

-kevin

If I comment the above one I am getting the following error
could not find component for path ‘EditCustomFieldSelectCheckbox’

If I enable the above in RT_SiteConfig.pm I am getting the following error
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 620.

With Regards
Vinod.R

From: Kevin Falcone falcone@bestpractical.com
To: rt-users@lists.bestpractical.com
Sent: Thursday, July 7, 2011 12:46 PM
Subject: Re: [rt-users] Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.

On Thu, Jul 07, 2011 at 08:42:27AM -0700, Direct Insure Online wrote:

We just upgraded our RT from 3.8.4 to 4.0.1
We upgraded the database also.

When we want to create a new custom field we are getting the following errors

Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 620.

What could be the problem.

The most common failure for something like this is that you have a
CustomField_Overlay.pm left over from 3.8 and didn’t follow the
directions. Alternately, you might have a local customization or
extension that affects Custom Fields.


2011 Training: http://bestpractical.com/services/training.html

Best regards, Ruslan.

Updated the database as you suggested.
Now on the form there are no radio button’s

You don’t say what is on the form.
I suspect you only updated part of the table.
Now that you’ve made RT not throw an error, you can fix it in the
Admin UI for that CF.

-kevin

Hi,

In RT4 it’s slightly different. See screenshots.On Fri, Jul 8, 2011 at 1:25 AM, Direct Insure Online vinod.rapolu@yahoo.com wrote:

Hi Kevin,

Updated the database as you suggested.
Now on the form there are no radio button’s

With Regards
Vinod.R
From: Kevin Falcone falcone@bestpractical.com
To: Direct Insure Online vinod.rapolu@yahoo.com
Sent: Thursday, July 7, 2011 4:31 PM
Subject: Re: [rt-users] Can’t coerce array into hash at
/opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.

On Thu, Jul 07, 2011 at 01:01:27PM -0700, Direct Insure Online wrote:

Hi Kevin,

I deleted all *_Overlay.pm files when I upgraded and I have the following
setting in RT_SiteConfig.pm
Set(@Plugins, qw(
RT::Authen::ExternalAuth
RT::Extension::CustomField::Checkbox
));

Ah, there’s the problem.

RT-Extension-CustomField-Checkbox has been superseded by RT4 (and in
fact is really incompatible with RT4). Unfortunately, there isn’t
currently an upgrade script, although we’ll make sure this gets into
the bug tracker.

You should be able to do something like this in your development
environment.

Find the entry in your CustomFields table with the Checkbox entry,
update Type to Select and DisplayType to List.

-kevin

If I comment the above one I am getting the following error
could not find component for path ‘EditCustomFieldSelectCheckbox’

If I enable the above in RT_SiteConfig.pm I am getting the following error
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm
line 696.
Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm
line 620.

With Regards
Vinod.R

From: Kevin Falcone falcone@bestpractical.com
To: rt-users@lists.bestpractical.com
Sent: Thursday, July 7, 2011 12:46 PM
Subject: Re: [rt-users] Can’t coerce array into hash at
/opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.

On Thu, Jul 07, 2011 at 08:42:27AM -0700, Direct Insure Online wrote:

We just upgraded our RT from 3.8.4 to 4.0.1
We upgraded the database also.

When we want to create a new custom field we are getting the
following errors

Can’t coerce array into hash at
/opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.
Can’t coerce array into hash at
/opt/rt3/sbin/…/lib/RT/CustomField.pm line 620.

What could be the problem.

The most common failure for something like this is that you have a
CustomField_Overlay.pm left over from 3.8 and didn’t follow the
directions. Alternately, you might have a local customization or
extension that affects Custom Fields.


2011 Training: http://bestpractical.com/services/training.html

Best regards, Ruslan.

Hi Ruslan,

I just updated the database as you mentioned. I am not getting any checkboxes/radio buttons on the forms
It just displaying 0 inplace of checkboxes/radio buttons

Is there any other steps I need to do after the database changes?

With Regards
Vinod.R

From: Ruslan Zakirov ruz@bestpractical.com
To: rt-users@lists.bestpractical.com
Sent: Thursday, July 7, 2011 5:58 PM
Subject: Re: [rt-users] Can’t coerce array into hash at /opt/rt3/sbin/…/lib/RT/CustomField.pm line 696.

Hi,

Try the following SQL query that should help. I’m preparing a new
version of the extension to stop people from using it under RT4 and
help them upgrade. We’ll try to automate process in 4.0.2.

UPDATE CustomFields SET Type = 'Select' AND RenderType = 'List'
WHERE Type = 'SelectCheckbox';