[rt-users] Scrip help needed

2009-09-24 Thread Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
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: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] Scrip help needed

2009-09-24 Thread Raed El-Hames
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


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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed

2009-09-24 Thread Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Hi Roy,
no success, still:   RT_System - Comments added 

:-(

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:r...@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: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed

2009-09-24 Thread Ruslan Zakirov
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.br...@kuehne-nagel.com wrote:
 Hi Roy,
 no success, still:       RT_System - Comments added

 :-(

 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:r...@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: sa...@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.
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] Scrip help needed

2009-09-24 Thread Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Hi Raed,

sorry for the typo in your name Raed ne Roy ;-)

Torsten 

-Ursprüngliche Nachricht-
Von: rt-users-boun...@lists.bestpractical.com 
[mailto:rt-users-boun...@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 

:-(

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:r...@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: 
sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed

2009-09-24 Thread Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
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 rightdigging in the dark 
:-(


-Ursprüngliche Nachricht-
Von: Ruslan Zakirov [mailto:ruslan.zaki...@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.br...@kuehne-nagel.com wrote:
 Hi Roy,
 no success, still:       RT_System - Comments added

 :-(

 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:r...@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

Re: [rt-users] Scrip help needed

2009-09-24 Thread Ruslan Zakirov
$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.br...@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 rightdigging in the 
 dark :-(


 -Ursprüngliche Nachricht-
 Von: Ruslan Zakirov [mailto:ruslan.zaki...@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.br...@kuehne-nagel.com wrote:
 Hi Roy,
 no success, still:       RT_System - Comments added

 :-(

 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:r...@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

Re: [rt-users] Scrip help needed

2009-09-24 Thread Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
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.zaki...@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.

On Thu, Sep 24, 2009 at 5:52 PM, Brumm, Torsten / Kuehne + Nagel / Ham MI-ID 
torsten.br...@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 rightdigging in 
 the dark :-(


 -Urspruengliche Nachricht-
 Von: Ruslan Zakirov [mailto:ruslan.zaki...@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.br...@kuehne-nagel.com wrote:
 Hi Roy,
 no success, still:   RT_System - Comments added

 :-(

 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

Re: [rt-users] Scrip help needed

2009-09-24 Thread Emmanuel Lacour
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 ;))

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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed

2009-09-24 Thread torsten.brumm
Hi Emmanuel,

will try it out tomorrow: done for today ;-)

Thanks for the hint.

Torsten

2009/9/24 Emmanuel Lacour elac...@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 ;))

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

 Community help: http://wiki.bestpractical.com
 Commercial support: sa...@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
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

[rt-users] Scrip help needed on date formatting

2009-03-03 Thread Kenneth Crocker
To all,


I'm a newbie to perl. I've written a few simple scrips and they are 
working just fine. My problem lies in my lack of understanding as to why 
some code will work in a perl program, but not in a scrip. We have some 
good perl programmers here and they gave me some code to use to format a 
date I needed.
Scenario: when a ticket has it's status changed to 'stalled', I want to 
update a Custom Field with the /mm/dd format for today's date. The 
code I was given for this is as follows:

Custom Action Prep Code:
# set the CF Work-Completed Date

my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
my $cf_obj = RT::CustomField-new($RT::SystemUser);
my $cf_name = Stalled Date;
( undef, undef, undef, $day, $mon, $year ) = localtime( time );
$cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

$cf_obj-LoadByName(Name=$cf_name);
$RT::Logger-debug(Loaded\$cf_obj-Name = . $cf_obj-Name() .\n);
$ticket-AddCustomFieldValue(Field=$cf_obj, Value=$cf_value, 
RecordTransaction=0);

return 1;

I get nothing. If I change the value of $cf_value to simply 
(localtime), I get the full-fledged format of Thu Feb 26 14:54:33 2009.
So, I know the condition works and the function of update the Custom 
Field works. I just cannot get the code I was given to format the date 
to work as a scrip.
Anyone have some experience with this and willing to help?


Kenn
LBNL

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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed on date formatting

2009-03-03 Thread Potla, Ashish Bassaliel
Hi,
Can you give some info about the CF you are using?
What is the type and validation settings on it?

-Ashish

From: rt-users-boun...@lists.bestpractical.com 
[rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker 
[kfcroc...@lbl.gov]
Sent: Wednesday, March 04, 2009 12:37 AM
To: rt Users
Subject: [rt-users] Scrip help needed on date formatting

To all,


I'm a newbie to perl. I've written a few simple scrips and they are
working just fine. My problem lies in my lack of understanding as to why
some code will work in a perl program, but not in a scrip. We have some
good perl programmers here and they gave me some code to use to format a
date I needed.
Scenario: when a ticket has it's status changed to 'stalled', I want to
update a Custom Field with the /mm/dd format for today's date. The
code I was given for this is as follows:

Custom Action Prep Code:
# set the CF Work-Completed Date

my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
my $cf_obj = RT::CustomField-new($RT::SystemUser);
my $cf_name = Stalled Date;
( undef, undef, undef, $day, $mon, $year ) = localtime( time );
$cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

$cf_obj-LoadByName(Name=$cf_name);
$RT::Logger-debug(Loaded\$cf_obj-Name = . $cf_obj-Name() .\n);
$ticket-AddCustomFieldValue(Field=$cf_obj, Value=$cf_value,
RecordTransaction=0);

return 1;

I get nothing. If I change the value of $cf_value to simply
(localtime), I get the full-fledged format of Thu Feb 26 14:54:33 2009.
So, I know the condition works and the function of update the Custom
Field works. I just cannot get the code I was given to format the date
to work as a scrip.
Anyone have some experience with this and willing to help?


Kenn
LBNL

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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed on date formatting

2009-03-03 Thread Potla, Ashish Bassaliel
Hey Ken,
localize the variables as follows and try it out :

my ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
my $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

-Ashish

From: rt-users-boun...@lists.bestpractical.com 
[rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker 
[kfcroc...@lbl.gov]
Sent: Wednesday, March 04, 2009 12:37 AM
To: rt Users
Subject: [rt-users] Scrip help needed on date formatting

To all,


I'm a newbie to perl. I've written a few simple scrips and they are
working just fine. My problem lies in my lack of understanding as to why
some code will work in a perl program, but not in a scrip. We have some
good perl programmers here and they gave me some code to use to format a
date I needed.
Scenario: when a ticket has it's status changed to 'stalled', I want to
update a Custom Field with the /mm/dd format for today's date. The
code I was given for this is as follows:

Custom Action Prep Code:
# set the CF Work-Completed Date

my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
my $cf_obj = RT::CustomField-new($RT::SystemUser);
my $cf_name = Stalled Date;
( undef, undef, undef, $day, $mon, $year ) = localtime( time );
$cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

$cf_obj-LoadByName(Name=$cf_name);
$RT::Logger-debug(Loaded\$cf_obj-Name = . $cf_obj-Name() .\n);
$ticket-AddCustomFieldValue(Field=$cf_obj, Value=$cf_value,
RecordTransaction=0);

return 1;

I get nothing. If I change the value of $cf_value to simply
(localtime), I get the full-fledged format of Thu Feb 26 14:54:33 2009.
So, I know the condition works and the function of update the Custom
Field works. I just cannot get the code I was given to format the date
to work as a scrip.
Anyone have some experience with this and willing to help?


Kenn
LBNL

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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed on date formatting

2009-03-03 Thread Kenneth Crocker
Ashish,

Just Enter one value. That's it. No validation settings. Although 
I've thought about using (?#Date 
/mm/dd)^(([1-2][0-9][0-9][0-9])\/(0[1-9]|1[0-2])\/(0[1-9]|[1-2][0-9]|3[0-1]))?$
 
as a validation setting.


Kenn
LBNL

On 3/3/2009 11:21 AM, Potla, Ashish Bassaliel wrote:
 Hi,
 Can you give some info about the CF you are using?
 What is the type and validation settings on it?
 
 -Ashish
 
 From: rt-users-boun...@lists.bestpractical.com 
 [rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker 
 [kfcroc...@lbl.gov]
 Sent: Wednesday, March 04, 2009 12:37 AM
 To: rt Users
 Subject: [rt-users] Scrip help needed on date formatting
 
 To all,
 
 
 I'm a newbie to perl. I've written a few simple scrips and they are
 working just fine. My problem lies in my lack of understanding as to why
 some code will work in a perl program, but not in a scrip. We have some
 good perl programmers here and they gave me some code to use to format a
 date I needed.
 Scenario: when a ticket has it's status changed to 'stalled', I want 
 to
 update a Custom Field with the /mm/dd format for today's date. The
 code I was given for this is as follows:
 
 Custom Action Prep Code:
 # set the CF Work-Completed Date
 
 my $trans = $self-TransactionObj;
 my $ticket = $self-TicketObj;
 my $cf_obj = RT::CustomField-new($RT::SystemUser);
 my $cf_name = Stalled Date;
 ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
 $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );
 
 $cf_obj-LoadByName(Name=$cf_name);
 $RT::Logger-debug(Loaded\$cf_obj-Name = . $cf_obj-Name() .\n);
 $ticket-AddCustomFieldValue(Field=$cf_obj, Value=$cf_value,
 RecordTransaction=0);
 
 return 1;
 
 I get nothing. If I change the value of $cf_value to simply
 (localtime), I get the full-fledged format of Thu Feb 26 14:54:33 2009.
 So, I know the condition works and the function of update the Custom
 Field works. I just cannot get the code I was given to format the date
 to work as a scrip.
 Anyone have some experience with this and willing to help?
 
 
 Kenn
 LBNL
 
 ___
 http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
 
 Community help: http://wiki.bestpractical.com
 Commercial support: sa...@bestpractical.com
 
 
 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com
 

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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed on date formatting

2009-03-03 Thread Kenneth Crocker
Ashish,


Tried that. No joy.


Kenn
LBNL

On 3/3/2009 11:40 AM, Potla, Ashish Bassaliel wrote:
 Hey Ken,
 localize the variables as follows and try it out :
 
 my ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
 my $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );
 
 -Ashish
 
 From: rt-users-boun...@lists.bestpractical.com 
 [rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker 
 [kfcroc...@lbl.gov]
 Sent: Wednesday, March 04, 2009 12:37 AM
 To: rt Users
 Subject: [rt-users] Scrip help needed on date formatting
 
 To all,
 
 
 I'm a newbie to perl. I've written a few simple scrips and they are
 working just fine. My problem lies in my lack of understanding as to why
 some code will work in a perl program, but not in a scrip. We have some
 good perl programmers here and they gave me some code to use to format a
 date I needed.
 Scenario: when a ticket has it's status changed to 'stalled', I want 
 to
 update a Custom Field with the /mm/dd format for today's date. The
 code I was given for this is as follows:
 
 Custom Action Prep Code:
 # set the CF Work-Completed Date
 
 my $trans = $self-TransactionObj;
 my $ticket = $self-TicketObj;
 my $cf_obj = RT::CustomField-new($RT::SystemUser);
 my $cf_name = Stalled Date;
 ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
 $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );
 
 $cf_obj-LoadByName(Name=$cf_name);
 $RT::Logger-debug(Loaded\$cf_obj-Name = . $cf_obj-Name() .\n);
 $ticket-AddCustomFieldValue(Field=$cf_obj, Value=$cf_value,
 RecordTransaction=0);
 
 return 1;
 
 I get nothing. If I change the value of $cf_value to simply
 (localtime), I get the full-fledged format of Thu Feb 26 14:54:33 2009.
 So, I know the condition works and the function of update the Custom
 Field works. I just cannot get the code I was given to format the date
 to work as a scrip.
 Anyone have some experience with this and willing to help?
 
 
 Kenn
 LBNL
 
 ___
 http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
 
 Community help: http://wiki.bestpractical.com
 Commercial support: sa...@bestpractical.com
 
 
 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com
 

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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed on date formatting

2009-03-03 Thread Potla, Ashish Bassaliel
Well, it worked for me!
Sorry.. keep tweaking it.

hope you have return 1; in the cleanup code as well.
-Ashish


From: Kenneth Crocker [kfcroc...@lbl.gov]
Sent: Wednesday, March 04, 2009 1:50 AM
To: Potla, Ashish Bassaliel
Cc: rt Users
Subject: Re: [rt-users] Scrip help needed on date formatting

Ashish,


Tried that. No joy.


Kenn
LBNL

On 3/3/2009 11:40 AM, Potla, Ashish Bassaliel wrote:
 Hey Ken,
 localize the variables as follows and try it out :

 my ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
 my $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

 -Ashish
 
 From: rt-users-boun...@lists.bestpractical.com 
 [rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker 
 [kfcroc...@lbl.gov]
 Sent: Wednesday, March 04, 2009 12:37 AM
 To: rt Users
 Subject: [rt-users] Scrip help needed on date formatting

 To all,


 I'm a newbie to perl. I've written a few simple scrips and they are
 working just fine. My problem lies in my lack of understanding as to why
 some code will work in a perl program, but not in a scrip. We have some
 good perl programmers here and they gave me some code to use to format a
 date I needed.
 Scenario: when a ticket has it's status changed to 'stalled', I want 
 to
 update a Custom Field with the /mm/dd format for today's date. The
 code I was given for this is as follows:

 Custom Action Prep Code:
 # set the CF Work-Completed Date

 my $trans = $self-TransactionObj;
 my $ticket = $self-TicketObj;
 my $cf_obj = RT::CustomField-new($RT::SystemUser);
 my $cf_name = Stalled Date;
 ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
 $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

 $cf_obj-LoadByName(Name=$cf_name);
 $RT::Logger-debug(Loaded\$cf_obj-Name = . $cf_obj-Name() .\n);
 $ticket-AddCustomFieldValue(Field=$cf_obj, Value=$cf_value,
 RecordTransaction=0);

 return 1;

 I get nothing. If I change the value of $cf_value to simply
 (localtime), I get the full-fledged format of Thu Feb 26 14:54:33 2009.
 So, I know the condition works and the function of update the Custom
 Field works. I just cannot get the code I was given to format the date
 to work as a scrip.
 Anyone have some experience with this and willing to help?


 Kenn
 LBNL

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

 Community help: http://wiki.bestpractical.com
 Commercial support: sa...@bestpractical.com


 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com


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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed on date formatting

2009-03-03 Thread Kenneth Crocker
Ashish,

Yep.


Kenn

On 3/3/2009 12:21 PM, Potla, Ashish Bassaliel wrote:
 Well, it worked for me!
 Sorry.. keep tweaking it.
 
 hope you have return 1; in the cleanup code as well.
 -Ashish
 
 
 From: Kenneth Crocker [kfcroc...@lbl.gov]
 Sent: Wednesday, March 04, 2009 1:50 AM
 To: Potla, Ashish Bassaliel
 Cc: rt Users
 Subject: Re: [rt-users] Scrip help needed on date formatting
 
 Ashish,
 
 
 Tried that. No joy.
 
 
 Kenn
 LBNL
 
 On 3/3/2009 11:40 AM, Potla, Ashish Bassaliel wrote:
 Hey Ken,
 localize the variables as follows and try it out :

 my ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
 my $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

 -Ashish
 
 From: rt-users-boun...@lists.bestpractical.com 
 [rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker 
 [kfcroc...@lbl.gov]
 Sent: Wednesday, March 04, 2009 12:37 AM
 To: rt Users
 Subject: [rt-users] Scrip help needed on date formatting

 To all,


 I'm a newbie to perl. I've written a few simple scrips and they are
 working just fine. My problem lies in my lack of understanding as to why
 some code will work in a perl program, but not in a scrip. We have some
 good perl programmers here and they gave me some code to use to format a
 date I needed.
 Scenario: when a ticket has it's status changed to 'stalled', I want 
 to
 update a Custom Field with the /mm/dd format for today's date. The
 code I was given for this is as follows:

 Custom Action Prep Code:
 # set the CF Work-Completed Date

 my $trans = $self-TransactionObj;
 my $ticket = $self-TicketObj;
 my $cf_obj = RT::CustomField-new($RT::SystemUser);
 my $cf_name = Stalled Date;
 ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
 $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

 $cf_obj-LoadByName(Name=$cf_name);
 $RT::Logger-debug(Loaded\$cf_obj-Name = . $cf_obj-Name() .\n);
 $ticket-AddCustomFieldValue(Field=$cf_obj, Value=$cf_value,
 RecordTransaction=0);

 return 1;

 I get nothing. If I change the value of $cf_value to simply
 (localtime), I get the full-fledged format of Thu Feb 26 14:54:33 2009.
 So, I know the condition works and the function of update the Custom
 Field works. I just cannot get the code I was given to format the date
 to work as a scrip.
 Anyone have some experience with this and willing to help?


 Kenn
 LBNL

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

 Community help: http://wiki.bestpractical.com
 Commercial support: sa...@bestpractical.com


 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com

 
 

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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip help needed on date formatting

2009-03-03 Thread Kenneth Crocker
Ashish,


Sorry. I'm such a dummy. I made your changes and when I tested it, I 
forgot to change a condition back to original (I was testing some other 
stuff). It now works, like you said it would. It was the missing my. 
THANKS!!

Kenn
LBNL




On 3/3/2009 12:21 PM, Potla, Ashish Bassaliel wrote:
 Well, it worked for me!
 Sorry.. keep tweaking it.
 
 hope you have return 1; in the cleanup code as well.
 -Ashish
 
 
 From: Kenneth Crocker [kfcroc...@lbl.gov]
 Sent: Wednesday, March 04, 2009 1:50 AM
 To: Potla, Ashish Bassaliel
 Cc: rt Users
 Subject: Re: [rt-users] Scrip help needed on date formatting
 
 Ashish,
 
 
 Tried that. No joy.
 
 
 Kenn
 LBNL
 
 On 3/3/2009 11:40 AM, Potla, Ashish Bassaliel wrote:
 Hey Ken,
 localize the variables as follows and try it out :

 my ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
 my $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

 -Ashish
 
 From: rt-users-boun...@lists.bestpractical.com 
 [rt-users-boun...@lists.bestpractical.com] On Behalf Of Kenneth Crocker 
 [kfcroc...@lbl.gov]
 Sent: Wednesday, March 04, 2009 12:37 AM
 To: rt Users
 Subject: [rt-users] Scrip help needed on date formatting

 To all,


 I'm a newbie to perl. I've written a few simple scrips and they are
 working just fine. My problem lies in my lack of understanding as to why
 some code will work in a perl program, but not in a scrip. We have some
 good perl programmers here and they gave me some code to use to format a
 date I needed.
 Scenario: when a ticket has it's status changed to 'stalled', I want 
 to
 update a Custom Field with the /mm/dd format for today's date. The
 code I was given for this is as follows:

 Custom Action Prep Code:
 # set the CF Work-Completed Date

 my $trans = $self-TransactionObj;
 my $ticket = $self-TicketObj;
 my $cf_obj = RT::CustomField-new($RT::SystemUser);
 my $cf_name = Stalled Date;
 ( undef, undef, undef, $day, $mon, $year ) = localtime( time );
 $cf_value = sprintf( '%d/%02d/%02d', $year + 1900, $mon, $day );

 $cf_obj-LoadByName(Name=$cf_name);
 $RT::Logger-debug(Loaded\$cf_obj-Name = . $cf_obj-Name() .\n);
 $ticket-AddCustomFieldValue(Field=$cf_obj, Value=$cf_value,
 RecordTransaction=0);

 return 1;

 I get nothing. If I change the value of $cf_value to simply
 (localtime), I get the full-fledged format of Thu Feb 26 14:54:33 2009.
 So, I know the condition works and the function of update the Custom
 Field works. I just cannot get the code I was given to format the date
 to work as a scrip.
 Anyone have some experience with this and willing to help?


 Kenn
 LBNL

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

 Community help: http://wiki.bestpractical.com
 Commercial support: sa...@bestpractical.com


 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com

 
 

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

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip Help needed (grabbing Organization)

2007-08-23 Thread Gene LeDuc

Hi Sean,

Here's my understanding of what you're trying to do:
1.  Ticket comes in to default incoming queue.
2.  An admin sees it and changes the Owner to himself.
3.  The ticket moves into the admin's personal queue.

If that is it, there's a pretty simple way to do this.  Use your On Owner 
Change scrip and replace the actions stuff with this.  It should move the 
ticket into a queue that has the same name as the ticket owner.


$self-TicketObj-SetQueue($self-TicketObj-OwnerObj-Name);

If your objective is something else, could you clarify that for me?

Regards,
Gene

At 06:28 PM 8/22/2007, Sean wrote:
Hi, I am trying to modify one of the contributed scrip's on here which 
relates to taking a ticket and having it automatically go to a certain 
queue. We have one queue that all requests go to (i.e. customer facing) 
and the admins have their own queues of responsibility. I didn't want to 
screw with custom fields, and because we don't use the information in the 
customer info page (i.e address etc..) I figured just for the admin's, I 
would put the queue name in the organization field. So, here is the scrip, 
which I have tried for hours to get to work (so there may be some 
extraneous things here) - Basically, the problem as I see it, is that I 
can't get the syntax or something correct to get the value in the 
organization field, as when I set: $newqueue = queue1 - the code DOES 
change the queue, but I can't get it to grab the value in the organization 
field. The scrip is Condition: On Owner Change, Action: User Defined, 
Template: Global template: blank, Stage is TransactionCreate Script in 
Custom condition: blank Scrip in Custom action preparation code: return 1 
Scrip in action cleanup code: my $User = new RT::User($RT::SystemUser); 
$User-Load( $User-Organization); my $newqueue = $User-Organization; 
$newqueue = ($User-Organization); $RT::Logger-info(Ticket took by an 
admin : new ticket in admin queue); my ($status, $msg) = 
$self-TicketObj-SetQueue($newqueue); 
$self-TicketObj-SetQueue($newqueue); $RT::Logger-info(Set queue to 
($newqueue)); return 1; Output in /var/log/messages: Aug 22 21:25:38 rt 
RT: Ticket took by an admin : new ticket in admin queue ((eva l 2459):6) 
Aug 22 21:25:38 rt RT: Set queue to () ((eval 2459):9) Thanks for any 
help. 
 
Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/

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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com



--
Gene LeDuc, GSEC
Security Analyst
San Diego State University 


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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip Help needed (grabbing Organization)

2007-08-23 Thread Kenneth Crocker

Sean,


	Why go through all that? Why not give each AdminCc of each different 
queue the right to SeeQueue, ShowTicket, ModifyTicket, 
CommentOnTicket in the general queue where all the tickets are held 
originally (maybe create a group named QueueAdmin for that purpose 
alone) that way they can find tickets they should work on in the general 
Queue and make a comment and change the queue (and maybe even assign an 
owner) all at once for any particular ticket so someone in the 
support-group that works on tickets in the new queue can take it. Either 
way, the ticket has been moved without the need of scrips or custom 
fields. BTW, the correct message would be Ticket taken  I either 
don't understand the question or the nned or both. ??



Kenn
LBNL

Sean wrote:

Hi,

I am trying to modify one of the contributed scrip's on here which relates to 
taking a ticket and having it automatically go to a certain queue.

We have one queue that all requests go to (i.e. customer facing) and the admins 
have their own queues of responsibility. I didn't want to screw with custom 
fields, and because we don't use the information in the customer info page (i.e 
address etc..) I figured just for the admin's, I would put the queue name in 
the organization field.

So, here is the scrip, which I have tried for hours to get to work (so there 
may be some extraneous things here) - Basically, the problem as I see it, is 
that I can't get the syntax or something correct to get the value in the 
organization field, as when I set:

$newqueue = queue1 - the code DOES change the queue, but I can't get it to grab the value in the organization field. 

The scrip is 
Condition: On Owner Change, 
Action: User Defined, 
Template: Global template: blank, 
Stage is TransactionCreate


Script in Custom condition: blank
Scrip in Custom action preparation code: 


return 1

Scrip in action cleanup code:

my $User = new RT::User($RT::SystemUser); 
$User-Load( $User-Organization);

my $newqueue = $User-Organization;
$newqueue = ($User-Organization);
$RT::Logger-info(Ticket took by an admin : new ticket in admin queue); 
my ($status, $msg) = $self-TicketObj-SetQueue($newqueue); 
$self-TicketObj-SetQueue($newqueue); 
$RT::Logger-info(Set queue to ($newqueue));

return 1;

Output in /var/log/messages:

Aug 22 21:25:38 rt RT: Ticket took by an admin : new ticket in admin queue ((eva
l 2459):6)
Aug 22 21:25:38 rt RT: Set queue to () ((eval 2459):9)

Thanks for any help.


   

Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/

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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com



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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip Help needed (grabbing Organization)

2007-08-23 Thread Sean
This did it. 

It was actually that we have a default incoming queue, and certain team members
are say, unix, and others are network, so when someone in the network team took
at ticket, it would move to the network queue (vs. having their own personal 
queue)
so i am storing the value of the queue (unix, network, etc...) in the 
Organization field, so
I took your snippet below:

$self-TicketObj-SetQueue($self-TicketObj-OwnerObj-Name);

and changed it to:

$self-TicketObj-SetQueue($self-TicketObj-OwnerObj-Organization); 

Thanks a million

-Sean

- Original Message 
From: Gene LeDuc [EMAIL PROTECTED]
To: Sean [EMAIL PROTECTED]; rt-users@lists.bestpractical.com
Sent: Thursday, August 23, 2007 11:18:20 AM
Subject: Re: [rt-users] Scrip Help needed (grabbing Organization)


Hi Sean,

Here's my understanding of what you're trying to do:
1.  Ticket comes in to default incoming queue.
2.  An admin sees it and changes the Owner to himself.
3.  The ticket moves into the admin's personal queue.

If that is it, there's a pretty simple way to do this.  Use your On Owner 
Change scrip and replace the actions stuff with this.  It should move the 
ticket into a queue that has the same name as the ticket owner.

$self-TicketObj-SetQueue($self-TicketObj-OwnerObj-Name);

If your objective is something else, could you clarify that for me?

Regards,
Gene

At 06:28 PM 8/22/2007, Sean wrote:
Hi, I am trying to modify one of the contributed scrip's on here which 
relates to taking a ticket and having it automatically go to a certain 
queue. We have one queue that all requests go to (i.e. customer facing) 
and the admins have their own queues of responsibility. I didn't want to 
screw with custom fields, and because we don't use the information in the 
customer info page (i.e address etc..) I figured just for the admin's, I 
would put the queue name in the organization field. So, here is the scrip, 
which I have tried for hours to get to work (so there may be some 
extraneous things here) - Basically, the problem as I see it, is that I 
can't get the syntax or something correct to get the value in the 
organization field, as when I set: $newqueue = queue1 - the code DOES 
change the queue, but I can't get it to grab the value in the organization 
field. The scrip is Condition: On Owner Change, Action: User Defined, 
Template: Global template: blank, Stage is TransactionCreate Script in 
Custom condition: blank Scrip in Custom action preparation code: return 1 
Scrip in action cleanup code: my $User = new RT::User($RT::SystemUser); 
$User-Load( $User-Organization); my $newqueue = $User-Organization; 
$newqueue = ($User-Organization); $RT::Logger-info(Ticket took by an 
admin : new ticket in admin queue); my ($status, $msg) = 
$self-TicketObj-SetQueue($newqueue); 
$self-TicketObj-SetQueue($newqueue); $RT::Logger-info(Set queue to 
($newqueue)); return 1; Output in /var/log/messages: Aug 22 21:25:38 rt 
RT: Ticket took by an admin : new ticket in admin queue ((eva l 2459):6) 
Aug 22 21:25:38 rt RT: Set queue to () ((eval 2459):9) Thanks for any 
help. 

 
Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


-- 
Gene LeDuc, GSEC
Security Analyst
San Diego State University


  

Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mailp=graduation+giftscs=bz
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] Scrip Help needed (grabbing Organization)

2007-08-23 Thread Ruslan Zakirov
Oh, you've found solution, I hope another reply will make things
clearer and help you next day :)

On 8/23/07, Sean [EMAIL PROTECTED] wrote:
 This did it.

 It was actually that we have a default incoming queue, and certain team 
 members
 are say, unix, and others are network, so when someone in the network team 
 took
 at ticket, it would move to the network queue (vs. having their own personal 
 queue)
 so i am storing the value of the queue (unix, network, etc...) in the 
 Organization field, so
 I took your snippet below:

 $self-TicketObj-SetQueue($self-TicketObj-OwnerObj-Name);

 and changed it to:

 $self-TicketObj-SetQueue($self-TicketObj-OwnerObj-Organization);

 Thanks a million

 -Sean

 - Original Message 
 From: Gene LeDuc [EMAIL PROTECTED]
 To: Sean [EMAIL PROTECTED]; rt-users@lists.bestpractical.com
 Sent: Thursday, August 23, 2007 11:18:20 AM
 Subject: Re: [rt-users] Scrip Help needed (grabbing Organization)


 Hi Sean,

 Here's my understanding of what you're trying to do:
 1.  Ticket comes in to default incoming queue.
 2.  An admin sees it and changes the Owner to himself.
 3.  The ticket moves into the admin's personal queue.

 If that is it, there's a pretty simple way to do this.  Use your On Owner
 Change scrip and replace the actions stuff with this.  It should move the
 ticket into a queue that has the same name as the ticket owner.

 $self-TicketObj-SetQueue($self-TicketObj-OwnerObj-Name);

 If your objective is something else, could you clarify that for me?

 Regards,
 Gene

 At 06:28 PM 8/22/2007, Sean wrote:
 Hi, I am trying to modify one of the contributed scrip's on here which
 relates to taking a ticket and having it automatically go to a certain
 queue. We have one queue that all requests go to (i.e. customer facing)
 and the admins have their own queues of responsibility. I didn't want to
 screw with custom fields, and because we don't use the information in the
 customer info page (i.e address etc..) I figured just for the admin's, I
 would put the queue name in the organization field. So, here is the scrip,
 which I have tried for hours to get to work (so there may be some
 extraneous things here) - Basically, the problem as I see it, is that I
 can't get the syntax or something correct to get the value in the
 organization field, as when I set: $newqueue = queue1 - the code DOES
 change the queue, but I can't get it to grab the value in the organization
 field. The scrip is Condition: On Owner Change, Action: User Defined,
 Template: Global template: blank, Stage is TransactionCreate Script in
 Custom condition: blank Scrip in Custom action preparation code: return 1
 Scrip in action cleanup code: my $User = new RT::User($RT::SystemUser);
 $User-Load( $User-Organization); my $newqueue = $User-Organization;
 $newqueue = ($User-Organization); $RT::Logger-info(Ticket took by an
 admin : new ticket in admin queue); my ($status, $msg) =
 $self-TicketObj-SetQueue($newqueue);
 $self-TicketObj-SetQueue($newqueue); $RT::Logger-info(Set queue to
 ($newqueue)); return 1; Output in /var/log/messages: Aug 22 21:25:38 rt
 RT: Ticket took by an admin : new ticket in admin queue ((eva l 2459):6)
 Aug 22 21:25:38 rt RT: Set queue to () ((eval 2459):9) Thanks for any
 help.
 
 Pinpoint customers who are looking for what you sell.
 http://searchmarketing.yahoo.com/
 ___
 http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
 
 Community help: http://wiki.bestpractical.com
 Commercial support: [EMAIL PROTECTED]
 
 
 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com


 --
 Gene LeDuc, GSEC
 Security Analyst
 San Diego State University


   
 
 Luggage? GPS? Comic books?
 Check out fitting gifts for grads at Yahoo! Search
 http://search.yahoo.com/search?fr=oni_on_mailp=graduation+giftscs=bz
 ___
 http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

 Community help: http://wiki.bestpractical.com
 Commercial support: [EMAIL PROTECTED]


 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com



-- 
Best regards, Ruslan.
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com


[rt-users] Scrip Help needed (grabbing Organization)

2007-08-22 Thread Sean
Hi,

I am trying to modify one of the contributed scrip's on here which relates to 
taking a ticket and having it automatically go to a certain queue.

We have one queue that all requests go to (i.e. customer facing) and the admins 
have their own queues of responsibility. I didn't want to screw with custom 
fields, and because we don't use the information in the customer info page (i.e 
address etc..) I figured just for the admin's, I would put the queue name in 
the organization field.

So, here is the scrip, which I have tried for hours to get to work (so there 
may be some extraneous things here) - Basically, the problem as I see it, is 
that I can't get the syntax or something correct to get the value in the 
organization field, as when I set:

$newqueue = queue1 - the code DOES change the queue, but I can't get it to 
grab the value in the organization field. 

The scrip is 
Condition: On Owner Change, 
Action: User Defined, 
Template: Global template: blank, 
Stage is TransactionCreate

Script in Custom condition: blank
Scrip in Custom action preparation code: 

return 1

Scrip in action cleanup code:

my $User = new RT::User($RT::SystemUser); 
$User-Load( $User-Organization);
my $newqueue = $User-Organization;
$newqueue = ($User-Organization);
$RT::Logger-info(Ticket took by an admin : new ticket in admin queue); 
my ($status, $msg) = $self-TicketObj-SetQueue($newqueue); 
$self-TicketObj-SetQueue($newqueue); 
$RT::Logger-info(Set queue to ($newqueue));
return 1;

Output in /var/log/messages:

Aug 22 21:25:38 rt RT: Ticket took by an admin : new ticket in admin queue ((eva
l 2459):6)
Aug 22 21:25:38 rt RT: Set queue to () ((eval 2459):9)

Thanks for any help.


   

Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com