[rt-users] Scrip help needed

Brumm, Torsten / Kuehne + Nagel / Ham MI-ID torsten.brumm at Kuehne-Nagel.com
Thu Sep 24 05:42:20 EDT 2009


Hi,
i'm trying to write a scrip which does the following:
 
We have two or more tickets, each ticket has a refersto to another like this:
 
#1 -> refers to #2
 
Now, if someone at ticket #2 writes an update, this update (reply in our case) should be posted also to ticket #1
 
Till this point it is working fine, now my problem: 
 
The Update on Ticket #1 is done by RT_System (from the scrip) after the user in ticket #2 writes an update and i have no idea at the moment, how can i do the update as the user, doing the reply on ticket #2 ?!?
 
The Part of the source writing back the update:
 
$related->BaseObj->Comment(
    Content => $self->loc( "Information added by [_1].", # loc
       $self->TransactionObj->CreatorObj->Name,
       ) . "\n" . $self->loc( "Notes: [_1]", # loc
       $note
       ),
     );  

I'm not sure how can i add the actual actor from Ticket #2 inside this part of code?!?
 
Below is my full source till now:
 
my $Clone = $self->TicketObj;
my $note;
my $t = $self->TicketObj->Transactions;
 $t->Limit( FIELD => 'Type', VALUE => 'Correspond' );
 $t->OrderByCols (
  { FIELD => 'Created',  ORDER => 'DESC' },
  { FIELD => 'id',     ORDER => 'DESC' },
        );
my $CommentObj = $t->First;
if( $CommentObj && $CommentObj->id ) {
 $note = $CommentObj->Content;
};
# Get the actual Actor of this transaction
my $Actor = $self->TransactionObj->Creator;
# $Actor has the ID of the actual Transaction
my $temp_user = RT::User->new();
$temp_user->Load($Actor);
my $AName = $temp_user->Name(); 
# Name of Actor in acutal Transaction - possibly not needed
 
while (my $related = $Clone->ReferredToBy->Next) {
  my $original = $Clone->id;
  my $relid = $related->BaseObj->id;
  $related->BaseObj->Comment(
    Content => $self->loc( "Information added by [_1].", # loc
       $self->TransactionObj->CreatorObj->Name,
       ) . "\n" . $self->loc( "Notes: [_1]", # loc
       $note
       ),
     );  
}
return 1; 
 
Any help is appriciated.

Torsten 

Kuehne + Nagel (AG & Co.) KG, Geschaeftsleitung: Hans-Georg Brinkmann (Vors.), Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 812773878, Persoenlich haftende Gesellschaft: Kuehne & Nagel A.G., Sitz: Contern/Luxemburg Geschaeftsfuehrender Verwaltungsrat: Klaus-Michael Kuehne



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090924/7eb6889e/attachment.htm>


More information about the rt-users mailing list