[rt-users] Scrip help needed

Raed El-Hames rfh at vialtus.com
Thu Sep 24 05:58:37 EDT 2009


Hi Torsten;

Try

$related->BaseObj->Comment(
    Creator => $self->TransactionObj->Creator,
    Content => $self->loc( "Information added by [_1].", # loc
       $self->TransactionObj->CreatorObj->Name,
       ) . "\n" . $self->loc( "Notes: [_1]", # loc
       $note
       ),
     ); 


Note the Creator line I added.

Regards;
Roy

Brumm, Torsten / Kuehne + Nagel / Ham MI-ID wrote:
> 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 
>
> Kühne + Nagel (AG & Co.) KG, Geschäftsleitung: 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, Persönlich haftende Gesellschaft: 
> Kühne & Nagel A.G., Sitz: Contern/Luxemburg, Geschäftsführender 
> Verwaltungsrat: Klaus-Michael Kühne
>
>



More information about the rt-users mailing list