RT <-> Trac integration

All,

I have a need to link together RT tickets and Trac tickets. Essentially, we do our change control within Trac. So, in RT, I have a CF “Change Control”, which, if set, I would like to have it link to the Trac ticket.

The problem is that the two ticket numbers won’t match, and trac ticket creation doesn’t appear to allow you to set the ticket number (no surprise).

Can anyone think of anyway to do get the Trac ticket number back and auto create the link?

Thanks

Scott

This e-mail message is intended only for the personal use of the recipient(s) named above. If you are not an intended recipient, you may not review, copy or distribute this message. If you have received this communication in error, please notify the Hearst Service Center (cadmin@hearstsc.com) immediately by email and delete the original message.

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

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 Roy,
no success, still: RT_System - Comments added

:frowning:

Thanks

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

-----Urspruengliche Nachricht-----Von: Raed El-Hames [mailto:rfh@vialtus.com]
Gesendet: Donnerstag, 24. September 2009 11:59
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Scrip help needed

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

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

Torsten,

Scrips work under system user, but you have to reload ticket as
creator of the transaction. Something like:

my $reply_will_be_on = RT::Ticket->new( $txn->CreatorObj );
$reply_will_be_on->Load( $ticket_you_found_as_system_user->id );
$reply_will_be_on->Comment(…);
…On Thu, Sep 24, 2009 at 2:39 PM, Brumm, Torsten / Kuehne + Nagel / Ham MI-ID torsten.brumm@kuehne-nagel.com wrote:

Hi Roy,
no success, still: RT_System - Comments added

:frowning:

Thanks

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

-----Urspruengliche Nachricht-----
Von: Raed El-Hames [mailto:rfh@vialtus.com]
Gesendet: Donnerstag, 24. September 2009 11:59
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Scrip help needed

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

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


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

Best regards, Ruslan.

Hi Raed,

sorry for the typo in your name Raed ne Roy :wink:

TorstenVon: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Im Auftrag von Brumm,Torsten / Kuehne + Nagel / Ham MI-ID
Gesendet: Donnerstag, 24. September 2009 12:39
An: Raed El-Hames
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Scrip help needed

Hi Roy,
no success, still: RT_System - Comments added

:frowning:

Thanks

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

-----Urspruengliche Nachricht-----
Von: Raed El-Hames [mailto:rfh@vialtus.com]
Gesendet: Donnerstag, 24. September 2009 11:59
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Scrip help needed

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

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

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

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

Hi Ruslan,

thanks for the hint. tried it with this piece of code:

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;
};
my $Actor = $self->TransactionObj->Creator;

while (my $related = $Clone->ReferredToBy->Next) {
my $original = $Clone->id;
my $relid = $related->BaseObj->id;
my $reply_will_be_on = RT::Ticket->new( $Actor );
$reply_will_be_on->Load( $related->BaseObj->id );
$reply_will_be_on->Comment( Content => $self->loc( “Information added by [_1].”, # loc
$Actor,
) . “\n” . $self->loc( “Notes: [_1]”, # loc
$note
),
);
}
return 1;

this ends up with:

[Thu Sep 24 13:47:26 2009] [error]: Scrip 1159 Commit failed: Can’t call method “UserObj” on an undefined value at /opt/rt3/lib/RT/Ticket_Overlay.pm line 3647.

OK, line 3647 from Ticket_Overlay:

$self->HasRight(
Principal => $self->CurrentUser->UserObj(),
Right => “$right”
)
);

OK, i’m working as superuser, so i should have the right…digging in the dark :-(Von: Ruslan Zakirov [mailto:ruslan.zakirov@gmail.com]
Gesendet: Donnerstag, 24. September 2009 15:23
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Cc: Raed El-Hames; rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Scrip help needed

Torsten,

Scrips work under system user, but you have to reload ticket as creator of the transaction. Something like:

my $reply_will_be_on = RT::Ticket->new( $txn->CreatorObj ); $reply_will_be_on->Load( $ticket_you_found_as_system_user->id ); $reply_will_be_on->Comment(…); …

Create a custom field, then setup the “link values to” field to point to
Trac’s ticket.

You can put an arbitrary URL in there that includes the value of your custom
field, your CF, in your case.

$self->TransactionObj->Creator returns id not a user object, when you
need object.On Thu, Sep 24, 2009 at 5:52 PM, Brumm, Torsten / Kuehne + Nagel / Ham MI-ID torsten.brumm@kuehne-nagel.com wrote:

Hi Ruslan,

thanks for the hint. tried it with this piece of code:

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;
};
my $Actor = $self->TransactionObj->Creator;

while (my $related = $Clone->ReferredToBy->Next) {
my $original = $Clone->id;
my $relid = $related->BaseObj->id;
my $reply_will_be_on = RT::Ticket->new( $Actor );
$reply_will_be_on->Load( $related->BaseObj->id );
$reply_will_be_on->Comment( Content => $self->loc( “Information added by [_1].”, # loc
$Actor,
) . “\n” . $self->loc( “Notes: [_1]”, # loc
$note
),
);
}
return 1;

this ends up with:

[Thu Sep 24 13:47:26 2009] [error]: Scrip 1159 Commit failed: Can’t call method “UserObj” on an undefined value at /opt/rt3/lib/RT/Ticket_Overlay.pm line 3647.

OK, line 3647 from Ticket_Overlay:

$self->HasRight(
Principal => $self->CurrentUser->UserObj(),
Right => “$right”
)
);

OK, i’m working as superuser, so i should have the right…digging in the dark :frowning:

-----Ursprüngliche Nachricht-----
Von: Ruslan Zakirov [mailto:ruslan.zakirov@gmail.com]
Gesendet: Donnerstag, 24. September 2009 15:23
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Cc: Raed El-Hames; rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Scrip help needed

Torsten,

Scrips work under system user, but you have to reload ticket as creator of the transaction. Something like:

my $reply_will_be_on = RT::Ticket->new( $txn->CreatorObj ); $reply_will_be_on->Load( $ticket_you_found_as_system_user->id ); $reply_will_be_on->Comment(…); …

On Thu, Sep 24, 2009 at 2:39 PM, Brumm, Torsten / Kuehne + Nagel / Ham MI-ID torsten.brumm@kuehne-nagel.com wrote:

Hi Roy,
no success, still: RT_System - Comments added

:frowning:

Thanks

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

-----Urspruengliche Nachricht-----
Von: Raed El-Hames [mailto:rfh@vialtus.com]
Gesendet: Donnerstag, 24. September 2009 11:59
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Cc: rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Scrip help needed

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

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


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


Best regards, Ruslan.

Best regards, Ruslan.

Hi Ruslan, Raed,

thanks for your support, it is working well now.

Attached again the correct working scrip action, if someone else has a need for this:

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;
};
my $Actor = $self->TransactionObj->Creator;
my $user = RT::User->new($RT::SystemUser);
$user->Load($Actor);
my $Name = $user->Name;

while (my $related = $Clone->ReferredToBy->Next) {
my $original = $Clone->id;
my $reply_will_be_on = RT::Ticket->new($user);
$reply_will_be_on->Load( $related->BaseObj->id );
$reply_will_be_on->Comment( Content => $self->loc( “Information added by [_1].”, # loc
$Name,
) . “\n” . $self->loc( “Notes: [_1]”, # loc
$note
),
);
}
return 1;

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

-----Urspruengliche Nachricht-----Von: Ruslan Zakirov [mailto:ruslan.zakirov@gmail.com]
Gesendet: Donnerstag, 24. September 2009 16:15
An: Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Cc: Raed El-Hames; rt-users@lists.bestpractical.com
Betreff: Re: [rt-users] Scrip help needed

$self->TransactionObj->Creator returns id not a user object, when you need object.

Hi Ruslan, Raed,

thanks for your support, it is working well now.

Attached again the correct working scrip action, if someone else has a need for this:

my $Actor = $self->TransactionObj->Creator;
my $user = RT::User->new($RT::SystemUser);
$user->Load($Actor);
my $Name = $user->Name;

FYI, you can use directly $self->TransactionObj->CreatorObj to get the
user object.

(CreatorObj does the same , i.e. load the user, but this will shorten
you scrip ;))

Hi Emmanuel,

will try it out tomorrow: done for today :wink:

Thanks for the hint.

Torsten2009/9/24 Emmanuel Lacour elacour@easter-eggs.com

On Thu, Sep 24, 2009 at 04:48:19PM +0200, Brumm, Torsten / Kuehne + Nagel / Ham MI-ID wrote:

Hi Ruslan, Raed,

thanks for your support, it is working well now.

Attached again the correct working scrip action, if someone else has a
need for this:

my $Actor = $self->TransactionObj->Creator;
my $user = RT::User->new($RT::SystemUser);
$user->Load($Actor);
my $Name = $user->Name;

FYI, you can use directly $self->TransactionObj->CreatorObj to get the
user object.

(CreatorObj does the same , i.e. load the user, but this will shorten
you scrip ;))


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

MFG

Torsten Brumm

http://www.brumm.me
http://www.elektrofeld.de

All,

I have a need to link together RT tickets and Trac tickets. Essentially, we do our change control within Trac. So, in RT, I have a CF “Change Control”, which, if set, I would like to have it link to the Trac ticket.

Can you explain a bit more about how you want the linkage to work? If
you’re up for trying out some “new” technology, our side-project, “SD”,
which you can get from http://syncwith.us is a P2P issue tracking system
which can sync to RT and can sync to trac. With a little bit of care and
a little bit of automation, you could sync all tickets (and ticket
updates) from trac into RT. If it’s important to push updates back to
trac, that’s doable too.

Jesse,

We are still working on exactly what we want as far as syncing, or, if that is even what we want to do.   We would much prefer to keep it all within RT, but, right now, I can't see a good way to do it.   There is too much free form information that RT doesn't seem well adapted to taking.

 As an example, when handling a change control, we have to document the servers (want a linked asset), the software, the person handling the change, the time and date of the change, the change description,  the change procedure (usually an attachment, but, could be just a few lines of text for an easy one..), the backout procedure,  testing data, and any procedures modifed (separate linked ticket), along with a few more details, and a raft of signatures....    This is currently done mostly manually, via paper forms.

I am researching how to do this electronically, and how to use RT to control the whole process.    The signatures part is handled via the Authorize mechanism, and every one seems ok with that.   But, how to capture the rest of this is complicated.

I have looked at forms (as in Xforms (orbeon), or Web 2.0 forms), and other ideas, and one is trac.   We use trac for other things anyways - more for the wiki then the ticketing, though!   But, a second look at trac makes it look like MAYBE we could use the ticketing side for the docuementation part of this project.   The most obvious problems are that the ticket numbers would not match, so, passing __id__ as part of a link in a CF to bring up the related TRAC ticket won't work.    Someone suggested manually typing the trac ticket into the CF, and using the __customField__ value, and, that works, sort of...   I didn't want the users to have to manually do the linking, and so far, I haven't really found a good way to link back from the trac ticket...   And all this is is a web link.  Nothing very substantial!

So… Anyone have any better ideas? Either for the whole project, or for the small piece of the project? I am, essentially, in day one of a fairly large project - just in the research phase of what is possible. Great time for new ideas!

Thanks
Scott-----Original Message-----
From: Jesse Vincent [mailto:jesse@bestpractical.com]
Sent: Thursday, September 24, 2009 5:43 PM
To: Lander, Scott
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] RT ↔ Trac integration

On Wed, Sep 23, 2009 at 11:44:25PM -0400, Lander, Scott wrote:

All,

I have a need to link together RT tickets and Trac tickets. Essentially, we do our change control within Trac. So, in RT, I have a CF “Change Control”, which, if set, I would like to have it link to the Trac ticket.

Can you explain a bit more about how you want the linkage to work? If you’re up for trying out some “new” technology, our side-project, “SD”, which you can get from http://syncwith.us is a P2P issue tracking system which can sync to RT and can sync to trac. With a little bit of care and a little bit of automation, you could sync all tickets (and ticket
updates) from trac into RT. If it’s important to push updates back to trac, that’s doable too.

This e-mail message is intended only for the personal use of the recipient(s) named above. If you are not an intended recipient, you may not review, copy or distribute this message. If you have received this communication in error, please notify the Hearst Service Center (cadmin@hearstsc.com) immediately by email and delete the original message.

As an example, when handling a change control, we have to document the servers >(want a linked asset), the software,

Maybe Google Code Archive - Long-term storage for Google Code Project Hosting.?

the person handling the change, the time and date of the change, the change
description, the change procedure (usually an attachment, but, could be just a few
lines of text for an easy one…),
Those tidbits all sound like part of a normal transaction in RT, not
free form info, to me.

the backout procedure, testing data, and any procedures modifed (separate linked
ticket), along with a few more details, and a raft of signatures… This is currently
done mostly manually, via paper forms.
This mostly just imposing a structure on how you use the tool I think?