[rt-users] Scrip help

2011-05-24 Thread Barry Carlyon
To follow up.

I have no idea what I just changed but it is working now.
As in I don't get a fail log type entry now

*confused*



Barry Carlyon
Freelance Web Developer
Freelance Lighting/AV Engineer

http://barrycarlyon.co.uk

mobile: 07729 048 443
skype: barrycarlyon
email: ba...@barrycarlyon.co.uk
msn: ba...@barrycarlyon.co.uk



Re: [rt-users] Scrip help

2011-05-24 Thread Barry Carlyon
Seems that my RT is compiling scrips and apache restart rather than at Run 
time

Now I'm even more confused as this is not mentioned in the wiki



Barry Carlyon
Freelance Web Developer
Freelance Lighting/AV Engineer

http://barrycarlyon.co.uk

mobile: 07729 048 443
skype: barrycarlyon
email: ba...@barrycarlyon.co.uk
msn: ba...@barrycarlyon.co.uk

On 24 May 2011, at 15:37, Barry Carlyon wrote:

 To follow up.
 
 I have no idea what I just changed but it is working now.
 As in I don't get a fail log type entry now
 
 *confused*
 
 
 
 Barry Carlyon
 Freelance Web Developer
 Freelance Lighting/AV Engineer
 
 http://barrycarlyon.co.uk
 
 mobile: 07729 048 443
 skype: barrycarlyon
 email: ba...@barrycarlyon.co.uk
 msn: ba...@barrycarlyon.co.uk
 



Re: [rt-users] Scrip help

2011-05-24 Thread Ruslan Zakirov
Hi,

When you work on a scrip in a file, you either use DevelMode or
restart web server every time you change the file. DevelMode helps in
most cases, but not always. If you see some error you don't understand
and DevelMode is enabled, try server restart, error may be different
after that and make sense.

On Tue, May 24, 2011 at 6:45 PM, Barry Carlyon ba...@barrycarlyon.co.uk wrote:
 Seems that my RT is compiling scrips and apache restart rather than at Run 
 time

 Now I'm even more confused as this is not mentioned in the wiki

 

 Barry Carlyon
 Freelance Web Developer
 Freelance Lighting/AV Engineer

 http://barrycarlyon.co.uk

 mobile: 07729 048 443
 skype: barrycarlyon
 email: ba...@barrycarlyon.co.uk
 msn: ba...@barrycarlyon.co.uk

 On 24 May 2011, at 15:37, Barry Carlyon wrote:

 To follow up.

 I have no idea what I just changed but it is working now.
 As in I don't get a fail log type entry now

 *confused*

 

 Barry Carlyon
 Freelance Web Developer
 Freelance Lighting/AV Engineer

 http://barrycarlyon.co.uk

 mobile: 07729 048 443
 skype: barrycarlyon
 email: ba...@barrycarlyon.co.uk
 msn: ba...@barrycarlyon.co.uk






-- 
Best regards, Ruslan.


Re: [rt-users] Scrip Help

2011-02-18 Thread Tom Elliott - Gyron
Hi All

Did anyone get a chance to look at this - really can't solve it :(

On 17 Feb 2011, at 08:57, Tom Elliott - Gyron wrote:

 Hi All
 Firstly, I should say, I'm really no coder. I can hack things about a bit, 
 but thats about it.
 I've adapted 
 http://requesttracker.wikia.com/wiki/AutoCloseOnNagiosRecoveryMessages into 
 the following.
 We use Opsview, which is a modified version of Nagios, and formats its emails 
 slightly differently. I've a scrip which is set for just the queue we need it 
 for, with:
 Condition: on create
 Action: user defined
 Template: global template: blank
 Stage TransactionBatch

 I've mashed the following:

 my $problem_desc = undef;
 my $problem_host = undef;
 my $problem = undef;
 my $search = undef;
 my $Transaction = $self-TransactionObj;
 my $subject = $Transaction-Attachments-First-GetHeader('Subject');
 if ($subject =~ /RECOVERY: (.+) is OK on host (.*)/) {
# This looks like a nagios recovery message
$problem_desc = $1;
$problem_host = $2;
$problem = $problem_desc on $problem_host;
$RT::Logger-debug(found a recovery msg: $problem);
 } else {
$RT::Logger-debug(not a recovery msg);
return 1;
 }
 # Ok, now let's merge this ticket with it's PROBLEM msg.
 my $search = RT::Tickets-new($RT::SystemUser);
$RT::Logger-debug(doing search);
 $search-LimitQueue(VALUE = 'Reports');
 $search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR = 
 'or');
 $search-LimitStatus(VALUE = 'open', OPERATOR = '=');
$RT::Logger-debug(did search);
 if ($search-Count == 0) { return 1; }
$RT::Logger-debug(starting loop);
 my $id = undef;
 while (my $ticket = $search-Next) {
 # Ignore the ticket that opened this transation (the recovery one...)
 next if $self-TicketObj-Id == $ticket-Id;
 # Look for nagios PROBLEM warning messages...
 if ( $ticket-Subject =~ /PROBLEM: (.+) is (CRITICAL|WARNING|UNKNOWN) on 
 host (.*)/ ) {
$RT::Logger-debug(checking msg);
$RT::Logger-debug(problem $problem checking $1 on $3);
 if ($1 on $3 eq $problem){
 $RT::Logger-debug(found ticket);
 # Aha! Found the Problem TICKET corresponding to this RECOVERY
 # ticket
 $id = $ticket-Id;
 # Nagios may send more then one PROBLEM message, right?
 $RT::Logger-debug(Merging ticket  . $self-TicketObj-Id .  
 into $id because of OA number match.);
 $self-TicketObj-MergeInto($id);
 # Keep looking for more PROBLEM tickets...
 }
 }
 }

 $id || return 1;
 # Auto-close/resolve this whole thing
 $self-TicketObj-SetStatus( resolved );
 1;

 Which is designed to look for messages with the subject line of:
 RECOVERY: name of service is OK on host name.of.host
 and then parse the remainder of the queue for associated problem tickets with 
 the subject line of
 PROBLEM: name of service is CRITICAL on host name.of.host
 when it finds them - it should merge and close.

 I actually want to extend this further to merge the 'problem' emails along 
 the way, but wanted to get this first stage working properly first.

 The above works, if I email in myself with a relevant subject line (scrip 62 
 is the relevant scrip)

 [Wed Feb 16 15:42:27 2011] [debug]: About to think about scrips for 
 transaction #1467131 (/opt/rt3/bin/../lib/RT/Transaction_Overlay.pm:163)
 [Wed Feb 16 15:42:27 2011] [debug]: Committing scrip #55 on txn #1467130 of 
 ticket #252411 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
 [Wed Feb 16 15:42:27 2011] [info]: Ticket 252411 created in queue 'Reports' 
 by tom.elliott (/opt/rt3/bin/../lib/RT/Ticket_Overlay.pm:667)
 [Wed Feb 16 15:42:27 2011] [debug]: Found 1 scrips for TransactionBatch stage 
 with applicable type(s) Create (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:370)
 [Wed Feb 16 15:42:27 2011] [debug]: Committing scrip #62 on txn #1467130 of 
 ticket #252411 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
 [Wed Feb 16 15:42:27 2011] [debug]: Found a recovery msg: name of service on 
 name.of.host ((eval 29152):20)
 [Wed Feb 16 15:42:27 2011] [debug]: doing search ((eval 29152):28)
 [Wed Feb 16 15:42:27 2011] [debug]: did search ((eval 29152):32)
 [Wed Feb 16 15:42:27 2011] [debug]: starting loop ((eval 29152):34)

 (heavily trimmed log)

 However, when our monitoring system emails in, it generates an email with 
 exactly the same subject and we get:

 Wed Feb 16 15:39:04 2011] [info]: Ticket 252408 created in queue 'Reports' by 
 nagios@opsview.[masked] (/opt/rt3/bin/../lib/RT/Ticket_Overlay.pm:667)
 [Wed Feb 16 15:39:04 2011] [debug]: Found 0 scrips for TransactionBatch stage 
 with applicable type(s)  (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:370)

 Any ideas? I'm aware this probably isn't enough information, but I'm not sure 
 what else to provide. I think I am probably doing something quite silly or 
 missing something fundamental. Perhaps I need a custom condition? Any input 
 really appreciated. Thanks all.

 --
 Kind regards,
 Tom 

[rt-users] Scrip Help

2011-02-17 Thread Tom Elliott - Gyron
Hi All
Firstly, I should say, I'm really no coder. I can hack things about a bit, but 
thats about it.
I've adapted 
http://requesttracker.wikia.com/wiki/AutoCloseOnNagiosRecoveryMessages into the 
following.
We use Opsview, which is a modified version of Nagios, and formats its emails 
slightly differently. I've a scrip which is set for just the queue we need it 
for, with:
Condition: on create
Action: user defined
Template: global template: blank
Stage TransactionBatch

I've mashed the following:

my $problem_desc = undef;
my $problem_host = undef;
my $problem = undef;
my $search = undef;
my $Transaction = $self-TransactionObj;
my $subject = $Transaction-Attachments-First-GetHeader('Subject');
if ($subject =~ /RECOVERY: (.+) is OK on host (.*)/) {
# This looks like a nagios recovery message
$problem_desc = $1;
$problem_host = $2;
$problem = $problem_desc on $problem_host;
$RT::Logger-debug(found a recovery msg: $problem);
} else {
$RT::Logger-debug(not a recovery msg);
return 1;
}
# Ok, now let's merge this ticket with it's PROBLEM msg.
 my $search = RT::Tickets-new($RT::SystemUser);
$RT::Logger-debug(doing search);
 $search-LimitQueue(VALUE = 'Reports');
 $search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR = 'or');
 $search-LimitStatus(VALUE = 'open', OPERATOR = '=');
$RT::Logger-debug(did search);
 if ($search-Count == 0) { return 1; }
$RT::Logger-debug(starting loop);
 my $id = undef;
 while (my $ticket = $search-Next) {
 # Ignore the ticket that opened this transation (the recovery one...)
 next if $self-TicketObj-Id == $ticket-Id;
 # Look for nagios PROBLEM warning messages...
 if ( $ticket-Subject =~ /PROBLEM: (.+) is (CRITICAL|WARNING|UNKNOWN) on 
host (.*)/ ) {
$RT::Logger-debug(checking msg);
$RT::Logger-debug(problem $problem checking $1 on $3);
 if ($1 on $3 eq $problem){
 $RT::Logger-debug(found ticket);
 # Aha! Found the Problem TICKET corresponding to this RECOVERY
 # ticket
 $id = $ticket-Id;
 # Nagios may send more then one PROBLEM message, right?
 $RT::Logger-debug(Merging ticket  . $self-TicketObj-Id .  
into $id because of OA number match.);
 $self-TicketObj-MergeInto($id);
 # Keep looking for more PROBLEM tickets...
 }
 }
 }

 $id || return 1;
 # Auto-close/resolve this whole thing
 $self-TicketObj-SetStatus( resolved );
 1;

Which is designed to look for messages with the subject line of:
RECOVERY: name of service is OK on host name.of.host
and then parse the remainder of the queue for associated problem tickets with 
the subject line of
PROBLEM: name of service is CRITICAL on host name.of.host
when it finds them - it should merge and close.

I actually want to extend this further to merge the 'problem' emails along the 
way, but wanted to get this first stage working properly first.

The above works, if I email in myself with a relevant subject line (scrip 62 is 
the relevant scrip)

[Wed Feb 16 15:42:27 2011] [debug]: About to think about scrips for transaction 
#1467131 (/opt/rt3/bin/../lib/RT/Transaction_Overlay.pm:163)
[Wed Feb 16 15:42:27 2011] [debug]: Committing scrip #55 on txn #1467130 of 
ticket #252411 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
[Wed Feb 16 15:42:27 2011] [info]: Ticket 252411 created in queue 'Reports' by 
tom.elliott (/opt/rt3/bin/../lib/RT/Ticket_Overlay.pm:667)
[Wed Feb 16 15:42:27 2011] [debug]: Found 1 scrips for TransactionBatch stage 
with applicable type(s) Create (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:370)
[Wed Feb 16 15:42:27 2011] [debug]: Committing scrip #62 on txn #1467130 of 
ticket #252411 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
[Wed Feb 16 15:42:27 2011] [debug]: Found a recovery msg: name of service on 
name.of.host ((eval 29152):20)
[Wed Feb 16 15:42:27 2011] [debug]: doing search ((eval 29152):28)
[Wed Feb 16 15:42:27 2011] [debug]: did search ((eval 29152):32)
[Wed Feb 16 15:42:27 2011] [debug]: starting loop ((eval 29152):34)

(heavily trimmed log)

However, when our monitoring system emails in, it generates an email with 
exactly the same subject and we get:

Wed Feb 16 15:39:04 2011] [info]: Ticket 252408 created in queue 'Reports' by 
nagios@opsview.[masked] (/opt/rt3/bin/../lib/RT/Ticket_Overlay.pm:667)
[Wed Feb 16 15:39:04 2011] [debug]: Found 0 scrips for TransactionBatch stage 
with applicable type(s)  (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:370)

Any ideas? I'm aware this probably isn't enough information, but I'm not sure 
what else to provide. I think I am probably doing something quite silly or 
missing something fundamental. Perhaps I need a custom condition? Any input 
really appreciated. Thanks all.

--
Kind regards,
Tom Elliott
Gyron Internet Ltd
mail:   tom.elli...@gyron.net
web:http://gyron.net/
tel:0845 888 6900
fax:0845 888 6910
24 hour customer support: 0845 888 6999

This message may be private and 

Re: [rt-users] Scrip help please.

2010-06-10 Thread Kenneth Crocker
Paul,

Perhaps I misunderstood. Are you wanting to meet these conditions at the
same time (ie. a create with a CF) or are these to be two separate
conditions exclusive of each other?

Kenn
LBNL

On Wed, Jun 9, 2010 at 3:37 PM, Dougherty Paul paul_doughe...@prn.comwrote:

  Hi Keith,



 These did not help…I have gotten closer to the error, however.



 It seems rather stupid, all I am trying to do is to get the condition to
 ring true in my scrip.



 This is what I have.



 ($self-TicketObj-FirstCustomFieldValue('Urgency') eq Critical);





 There are no errors generated by this scrip…but it doesn’t add the
 watchers…(this part works when the above condition is met). For example, if
 I simply use this…($self-TransactionObj-Type eq Create); in the
 condition, the scrip adds the watchers.



 Watcher add code:

 $self-TicketObj-AddWatcher( Type = Cc,

   Email =paul_dougher...@prn.com);

 push( @{$self-{'To'}},

   $self-TicketObj-Requestors-MemberEmailAddresses,

   $self-TicketObj-QueueObj-Cc-MemberEmailAddresses );

 return 1;



 Any ideas?



 Thanks,


 Paul



 *From:* Kenneth Crocker [mailto:kfcroc...@lbl.gov]
 *Sent:* Thursday, June 03, 2010 9:00 AM
 *To:* Dougherty Paul

 *Subject:* Re: [rt-users] Scrip help please.



 Paul,

 I have attached two txt files that have the code in them. These files have
 flower box comments and such that I always use to maintain my code. have fun
 with them.

 Kenn
 LBNL

 On Thu, Jun 3, 2010 at 8:27 AM, Dougherty Paul paul_doughe...@prn.com
 wrote:

 Hi Ken,



 Sure, I might be able to use those.



 Thanks,



 Paul



 *From:* rt-users-boun...@lists.bestpractical.com [mailto:
 rt-users-boun...@lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
 *Sent:* Wednesday, June 02, 2010 5:07 PM
 *To:* rt-users@lists.bestpractical.com
 *Subject:* Re: [rt-users] Scrip help please.



 Paul,

 I have some code that adds a CC to an individual ticket on a Queue basis.
 So, if you want this for just certain types of tickets, maybe you could
 modify it for those conditions and put it in the Queues relevant to that
 need. OH, I also have some code that add's *additional* Cc's on
 Correspondence with those tickets as well. Is that something you might be
 interested in using?

 Kenn
 LBNL

 On Wed, Jun 2, 2010 at 2:50 PM, Dougherty Paul paul_doughe...@prn.com
 wrote:

 Hi,



 I am sure this is an id10t error, but I am trying to write a scrip that
 sends an adds a “CC” to a new ticket whose urgency is Critical (or
 critical). So far, the closest I have gotten is to have the system add the
 “CC”’s for every new ticket.



 Here is the custom condition that is giving me the fits. The current error
 I am receiving involves a syntax error…thing is, no matter what I try, I
 cannot get this thing to work. Every other part of this process works (ie,
 when the cc’s are added, the email is sent. The custom action does indeed
 add the cc’s).



 I just need to meet three conditions. One is on create, the other is
 Urgency (custom field) Critical or Urgency critical.



 Thanks,


 Paul





 Custom condition:

 if ( ($self-TransactionObj-Type eq Create) 

 ( ( $self-TicketObj-FirstCustomFieldValue('Urgency')
 eq Critical) || ( $self-TicketObj-FirstCustomFieldValue('Urgency') eq
 critical)))

 return 1;

 else

 return 0;



 Custom action: (runs fine):

 $self-TicketObj-AddWatcher( Type = Cc,

   Email =x...@prn.com);

 $self-TicketObj-AddWatcher( Type = Cc,

   Email =x...@prn.com);

 push( @{$self-{'To'}},

   $self-TicketObj-Requestors-MemberEmailAddresses,

   $self-TicketObj-QueueObj-Cc-MemberEmailAddresses );

 return 1;



 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.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 please.

2010-06-10 Thread Kenneth Crocker
Paul,

I may be wrong, but I think the reason is that when a ticket is being
created, I don't believe that the Ticket Custom Field: is available at the
time of Custom Condition. I think you will have to add the code that
checks on the value of the Ticket Custom Field in one of the Custom Action
sections along with your code to add the Cc's. That also may be why the
example has an or in that code. Hope this helps.

Kenn
LBNL

On Thu, Jun 10, 2010 at 1:53 PM, Dougherty Paul paul_doughe...@prn.comwrote:

  Hi Keith,



 First off, thanks for your help.



 This is what I am trying to implement…
 http://wiki.bestpractical.com/view/AddWatcherPerTicket



 I want this to fire when tickets are created and when the custom field of
 Urgency (already created and gets poplutated) is critical.



 This is from the wiki…

 return undef unless ( ($self-TransactionObj-Type eq Create) ||

  ( $self-TicketObj-FirstCustomFieldValue('Urgency')
 eq High));

 return 1;



 So what I am trying to do is change the or statement to an and with  and
 change the High to Critical….but somehow this fails. I have tried every
 combination I can think of….



 Interestingly, I can get the first part (create) to fire correctly when it
 is by itself. I cannot get the Urgency part to ever evaluate as true.



 Cheers,



 Paul



 *From:* rt-users-boun...@lists.bestpractical.com [mailto:
 rt-users-boun...@lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
 *Sent:* Thursday, June 10, 2010 1:40 PM

 *To:* rt-users@lists.bestpractical.com
 *Subject:* Re: [rt-users] Scrip help please.



 Paul,

 Perhaps I misunderstood. Are you wanting to meet these conditions at the
 same time (ie. a create with a CF) or are these to be two separate
 conditions exclusive of each other?

 Kenn
 LBNL

 On Wed, Jun 9, 2010 at 3:37 PM, Dougherty Paul paul_doughe...@prn.com
 wrote:

 Hi Keith,



 These did not help…I have gotten closer to the error, however.



 It seems rather stupid, all I am trying to do is to get the condition to
 ring true in my scrip.



 This is what I have.



 ($self-TicketObj-FirstCustomFieldValue('Urgency') eq Critical);





 There are no errors generated by this scrip…but it doesn’t add the
 watchers…(this part works when the above condition is met). For example, if
 I simply use this…($self-TransactionObj-Type eq Create); in the
 condition, the scrip adds the watchers.



 Watcher add code:

 $self-TicketObj-AddWatcher( Type = Cc,

   Email =paul_dougher...@prn.com);

 push( @{$self-{'To'}},

   $self-TicketObj-Requestors-MemberEmailAddresses,

   $self-TicketObj-QueueObj-Cc-MemberEmailAddresses );

 return 1;



 Any ideas?



 Thanks,


 Paul



 *From:* Kenneth Crocker [mailto:kfcroc...@lbl.gov]
 *Sent:* Thursday, June 03, 2010 9:00 AM
 *To:* Dougherty Paul


 *Subject:* Re: [rt-users] Scrip help please.



 Paul,

 I have attached two txt files that have the code in them. These files have
 flower box comments and such that I always use to maintain my code. have fun
 with them.

 Kenn
 LBNL

 On Thu, Jun 3, 2010 at 8:27 AM, Dougherty Paul paul_doughe...@prn.com
 wrote:

 Hi Ken,



 Sure, I might be able to use those.



 Thanks,



 Paul



 *From:* rt-users-boun...@lists.bestpractical.com [mailto:
 rt-users-boun...@lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
 *Sent:* Wednesday, June 02, 2010 5:07 PM
 *To:* rt-users@lists.bestpractical.com
 *Subject:* Re: [rt-users] Scrip help please.



 Paul,

 I have some code that adds a CC to an individual ticket on a Queue basis.
 So, if you want this for just certain types of tickets, maybe you could
 modify it for those conditions and put it in the Queues relevant to that
 need. OH, I also have some code that add's *additional* Cc's on
 Correspondence with those tickets as well. Is that something you might be
 interested in using?

 Kenn
 LBNL

 On Wed, Jun 2, 2010 at 2:50 PM, Dougherty Paul paul_doughe...@prn.com
 wrote:

 Hi,



 I am sure this is an id10t error, but I am trying to write a scrip that
 sends an adds a “CC” to a new ticket whose urgency is Critical (or
 critical). So far, the closest I have gotten is to have the system add the
 “CC”’s for every new ticket.



 Here is the custom condition that is giving me the fits. The current error
 I am receiving involves a syntax error…thing is, no matter what I try, I
 cannot get this thing to work. Every other part of this process works (ie,
 when the cc’s are added, the email is sent. The custom action does indeed
 add the cc’s).



 I just need to meet three conditions. One is on create, the other is
 Urgency (custom field) Critical or Urgency critical.



 Thanks,


 Paul





 Custom condition:

 if ( ($self-TransactionObj-Type eq Create) 

 ( ( $self-TicketObj-FirstCustomFieldValue('Urgency')
 eq Critical) || ( $self-TicketObj-FirstCustomFieldValue('Urgency') eq
 critical)))

 return 1;

 else

 return 0;



 Custom action: (runs fine

[rt-users] Scrip help please.

2010-06-02 Thread Dougherty Paul
Hi,

 

I am sure this is an id10t error, but I am trying to write a scrip that
sends an adds a CC to a new ticket whose urgency is Critical (or
critical). So far, the closest I have gotten is to have the system add
the CC's for every new ticket.

 

Here is the custom condition that is giving me the fits. The current
error I am receiving involves a syntax error...thing is, no matter what
I try, I cannot get this thing to work. Every other part of this process
works (ie, when the cc's are added, the email is sent. The custom action
does indeed add the cc's).

 

I just need to meet three conditions. One is on create, the other is
Urgency (custom field) Critical or Urgency critical.

 

Thanks,


Paul

 

 

Custom condition:

if ( ($self-TransactionObj-Type eq Create) 

( (
$self-TicketObj-FirstCustomFieldValue('Urgency') eq Critical) || (
$self-TicketObj-FirstCustomFieldValue('Urgency') eq critical)))

return 1;

else 

return 0;

 

Custom action: (runs fine):

$self-TicketObj-AddWatcher( Type = Cc, 

  Email =x...@prn.com); 

$self-TicketObj-AddWatcher( Type = Cc, 

  Email =x...@prn.com); 

push( @{$self-{'To'}}, 

  $self-TicketObj-Requestors-MemberEmailAddresses, 

  $self-TicketObj-QueueObj-Cc-MemberEmailAddresses ); 

return 1;


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

[rt-users] Scrip Help?

2010-01-17 Thread Aaron Guise
Hi All,

I have a scrip setup as below;

Condition:  OnComment
Action:  User Defined
Template:  Global Blank
Stage:   Transaction Create

Custom Condition:
Custom Action Preparation Code: return 1;
Custom Action Cleanup Code:
my $string = $self-TransactionObj-Content;
$string =~ m/Status changed from ([A-Za-z]{3}) to ([A-Za-z]{3})/;

my $old = $1;
my $new = $2;
my $ticket = $self-TicketObj;
my $cf_obj = RT::CustomField-new($RT::SystemUser);
my $cf_name = CustomStatus;
my $cf_value;
$cf_value = $new;
$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=1);
return 1;

However the damn thing never seems to fire off,  I have tested the regexp
directly in perl and it works.  I am pretty sure also that it used to work
but for some reason no longer does.

Essentially we have rules on our mail clients which forward mail back to RT
from our outsourced Service provider,  the content looks like this when they
change a status.

Subject: SR129018, CustRef: 54795, QUE

 atus.

This is an automatically generated email from Aaron Guise using Gentrack SR
System.



SR129018, CustRef: 54795

https://www.gentrack.com/srweb/srdetails.asp?SRNo=129018

Status changed from WAI to QUE



Think before you Print - By making good use of resources at work we can
encourage sustainability and manage our impact. Change Tomorrow by Changing
Thinking Today





Disclaimer:

The information contained in this email may be confidential. If you are not
the intended recipient, you must not disclose or use the information in this
email or any attachment in any way.

If you received it in error, please tell us immediately by return email, and
delete the document. Genesis Power Limited, trading as Genesis Energy, does
not accept any responsibility for viruses or anything similar in this email
or any attachments. We also do not guarantee the integrity of any emails or
attached files or accept any responsibility for any changes made to them by
any other person.


Does anyone have any ideas why this may not be triggering.  I may be just
losing sight of a simple thing I feel, but it is now driving me a little
nuts.
*
Regards,*

*Aaron Guise

  07 838 7793
027 212 6638
aa...@guise.net.nz
 *


MSN: gui...@hotmail.com
 [image: Facebook] http://www.facebook.com/shadysandman
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

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

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22  23
Dublin, Ireland - Mar 15  16
Boston, MA, USA - April 5  6
Washington DC, USA - Oct 25  26

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

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

Re: [rt-users] Scrip Help

2009-06-11 Thread Ken Crocker

Aaron,

   We use this code:

# condition set on email transaction to create

my $trans = $self-TransactionObj;
my $msgattr = $trans-Message-First;

return 0 unless $trans-Type eq Create;
return 0 unless $msgattr;
return 1 if $msgattr-GetHeader('Received');
return 0;

   Hope this helps.

Kenn
LBNL

On 6/10/2009 7:04 PM, Aaron Guise wrote:

Thanks Jerrad,

I couldn't remember where I had seen this before.   I since had a good 
search and found it on the Wiki.


*Regards,*

*Aaron Guise
027 212 6638
aa...@guise.net.nz mailto:aa...@guise.net.nz
 *



On Thu, Jun 11, 2009 at 12:59 PM, Jerrad Pierce 
jpie...@cambridgeenergyalliance.org 
mailto:jpie...@cambridgeenergyalliance.org wrote:


This info exists somewhere on the wiki as a user-contributed
enhancement.

--
Cambridge Energy Alliance: Save money. Save the planet.




___
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

[rt-users] Scrip Help

2009-06-10 Thread Aaron Guise
Hi,

Is it possible to differentiate via Scrip whether a ticket is created via
the RT Gui or an email being sent?  I cannot seem to come up with something
concrete that works just yet.

*Regards,*

*Aaron Guise
027 212 6638
aa...@guise.net.nz
 *
___
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

2009-06-10 Thread Kimberly McKinnis
What if you put in something to pull info from the headers? I have a line in a 
scrip that determines which support account an email was sent to. It's empty if 
the ticket was sent through the GUI.

my $to = $self-TransactionObj-Attachments-First-GetHeader('To');

$RT::Logger-debug(To email was: $to);
.
.
.


From: rt-users-boun...@lists.bestpractical.com 
[mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Aaron Guise
Sent: Wednesday, June 10, 2009 5:47 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Scrip Help

Hi,

Is it possible to differentiate via Scrip whether a ticket is created via the 
RT Gui or an email being sent?  I cannot seem to come up with something 
concrete that works just yet.

Regards,

Aaron Guise
[http://www.guise.net.nz/images/signatures/mob.gif]027 212 6638
[http://www.guise.net.nz/images/signatures/email.gif]aa...@guise.net.nzmailto:aa...@guise.net.nz


___
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

2009-06-10 Thread Jerrad Pierce
This info exists somewhere on the wiki as a user-contributed enhancement.

-- 
Cambridge Energy Alliance: Save money. Save the planet.
___
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

2009-06-10 Thread Aaron Guise
Thanks Jerrad,

I couldn't remember where I had seen this before.   I since had a good
search and found it on the Wiki.

*Regards,*

*Aaron Guise
027 212 6638
aa...@guise.net.nz
 *



On Thu, Jun 11, 2009 at 12:59 PM, Jerrad Pierce 
jpie...@cambridgeenergyalliance.org wrote:

 This info exists somewhere on the wiki as a user-contributed enhancement.

 --
 Cambridge Energy Alliance: Save money. Save the planet.

___
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 with error message

2009-04-08 Thread Ken Crocker
To all,

I have a scrip that evaluates a CF to see if it has been modified. 
If NOT, I wanted to send out an error message for RT to display in the 
Modify Ticket screen. This is the action code:

$RT::Logger-error(Resolution Type  NOT SET!);

return 1;

I get nothing. Does anyone have some code I can borrow for this? Thanks.

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


[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


[rt-users] Scrip help

2007-10-18 Thread Kenneth Crocker

To all,


	I have a scrip that is supposed to modify the ticket owner to Nobody 
when the ticket is moved to another queue. What I have is:


Name: Mod Owner on Q chg
Condition: On Queue Change
Action: User Defined
Template: Blank
Stage: TransactionBatch

Custom Condition: none
Custom Action Prep Code:
# set new Ticket Owner value

my $Ticket = $self-TicketObj;
$Ticket-SetOwner('Nobody');
return 1;

Custom Action Cleanup Code: none

	Actually, I also tried it with Return 1: in the prep code and the 
modifying code in the cleanup and still no go with either way. Here I 
was thinking it would be a simple scrip and I can't get it to work. I am 
also executing a notification scrip for the same condition and it works. 
Anyone have an idea on what's wrong? Thanks.



Kenn
LBNL
___
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

2007-10-18 Thread Mathew Snyder
Custom action preparation code:
return 1;

Custom action cleanup code:
$RT::Logger-debug(trying to set owner);
my ($code, $msg) = $self-TicketObj-SetOwner(10, 'Force');
$RT::Logger-debug(set owner: $code: $msg);

return 1;



Keep up with me and what I'm up to: http://theillien.blogspot.com


Kenneth Crocker wrote:
 To all,
 
 
 I have a scrip that is supposed to modify the ticket owner to
 Nobody when the ticket is moved to another queue. What I have is:
 
 Name: Mod Owner on Q chg
 Condition: On Queue Change
 Action: User Defined
 Template: Blank
 Stage: TransactionBatch
 
 Custom Condition: none
 Custom Action Prep Code:
 # set new Ticket Owner value
 
 my $Ticket = $self-TicketObj;
 $Ticket-SetOwner('Nobody');
 return 1;
 
 Custom Action Cleanup Code: none
 
 Actually, I also tried it with Return 1: in the prep code and the
 modifying code in the cleanup and still no go with either way. Here I
 was thinking it would be a simple scrip and I can't get it to work. I am
 also executing a notification scrip for the same condition and it works.
 Anyone have an idea on what's wrong? Thanks.
 
 
 Kenn
 LBNL
 ___
 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

2007-10-18 Thread Kenneth Crocker

Mathew,


	It worked great! Thanks! I figured I might need the object id as 
opposed to name. I didn't realise I needed to do a force either. Thanks 
again.



Kenn
LBNL

On 10/18/2007 10:48 AM, Mathew Snyder wrote:

Custom action preparation code:
return 1;

Custom action cleanup code:
$RT::Logger-debug(trying to set owner);
my ($code, $msg) = $self-TicketObj-SetOwner(10, 'Force');
$RT::Logger-debug(set owner: $code: $msg);

return 1;



Keep up with me and what I'm up to: http://theillien.blogspot.com


Kenneth Crocker wrote:

To all,


I have a scrip that is supposed to modify the ticket owner to
Nobody when the ticket is moved to another queue. What I have is:

Name: Mod Owner on Q chg
Condition: On Queue Change
Action: User Defined
Template: Blank
Stage: TransactionBatch

Custom Condition: none
Custom Action Prep Code:
# set new Ticket Owner value

my $Ticket = $self-TicketObj;
$Ticket-SetOwner('Nobody');
return 1;

Custom Action Cleanup Code: none

Actually, I also tried it with Return 1: in the prep code and the
modifying code in the cleanup and still no go with either way. Here I
was thinking it would be a simple scrip and I can't get it to work. I am
also executing a notification scrip for the same condition and it works.
Anyone have an idea on what's wrong? Thanks.


Kenn
LBNL
___
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) Deleting a requestor upon ticket creation.

2007-10-16 Thread Mathew Snyder
This is a scrip I use for adding a requestor.  All you'd have to do is change
the AddWatcher to DeleteWatcher and set up your conditions to what you need:

Condition: User Defined
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate

Custom condition:
You'll either want to come up with your own or set the condition above to On
Create or whatever.

Custom action preparation code:
return 1;

Custom action cleanup code:
$self-TicketObj-AddWatcher (
Type  = 'Requestor',
Email = '[EMAIL PROTECTED]'
);

Keep up with me and what I'm up to: http://theillien.blogspot.com


Chris Nelson wrote:
 Hello list,
 
 I have a rather strange request, I want to delete a requestor when a
 ticket is created.  Reason being, as the ticket is assigned to different
 queues, replies to requestor are sent by the other queues, and that is
 usually not needed for external requests. The easiest way to address
 this would be to just remove the requestors on tickets created in that
 queue.
 
 
 Looking at the perldoc for Record.pm, I noticed that we can use
 DeleteAttribute, so I tried:
 Condition: On create
 Action: User Defined
 Template: Global Template: Blank
 Stage: Transaction Create
 
 Custom Condition:
 
 Custom Action preparation Code: return 1;
 
 Custom action cleanup code:
 
 $self-TicketObj-DeleteAttribute('Requestor');
 
 
 
 But nothing's actually happening, and the requestor is listed on the
 webui still. Is there a better way to do this? Am I even barking up the
 right tree? Thanks in advance for your help.
 
 
___
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) Deleting a requestor upon ticket creation.

2007-10-16 Thread Chris Nelson

That worked!

The custom action cleanup code I had to use is:

my $T_Obj = $self-TicketObj;
my $requestor_address = $T_Obj-RequestorAddresses;
$RT::Logger-info(* ReqAddr is $requestor_address);
$T_Obj-DeleteWatcher (
   Type  = Requestor,
   Email = $requestor_address
);
$RT::Logger-info(* After deletewatcher);
return 1;


Thanks for your help guys :)




Mathew Snyder wrote:

This is a scrip I use for adding a requestor.  All you'd have to do is change
the AddWatcher to DeleteWatcher and set up your conditions to what you need:

Condition: User Defined
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate

Custom condition:
You'll either want to come up with your own or set the condition above to On
Create or whatever.

Custom action preparation code:
return 1;

Custom action cleanup code:
$self-TicketObj-AddWatcher (
Type  = 'Requestor',
Email = '[EMAIL PROTECTED]'
);

Keep up with me and what I'm up to: http://theillien.blogspot.com


Chris Nelson wrote:
  

Hello list,

I have a rather strange request, I want to delete a requestor when a
ticket is created.  Reason being, as the ticket is assigned to different
queues, replies to requestor are sent by the other queues, and that is
usually not needed for external requests. The easiest way to address
this would be to just remove the requestors on tickets created in that
queue.


Looking at the perldoc for Record.pm, I noticed that we can use
DeleteAttribute, so I tried:
Condition: On create
Action: User Defined
Template: Global Template: Blank
Stage: Transaction Create

Custom Condition:

Custom Action preparation Code: return 1;

Custom action cleanup code:

$self-TicketObj-DeleteAttribute('Requestor');



But nothing's actually happening, and the requestor is listed on the
webui still. Is there a better way to do this? Am I even barking up the
right tree? Thanks in advance for your help.





  



--
Chris Nelson


___
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) Deleting a requestor upon ticket creation.

2007-10-15 Thread Chris Nelson

Hello list,

I have a rather strange request, I want to delete a requestor when a 
ticket is created.  Reason being, as the ticket is assigned to different 
queues, replies to requestor are sent by the other queues, and that is 
usually not needed for external requests. The easiest way to address 
this would be to just remove the requestors on tickets created in that 
queue.



Looking at the perldoc for Record.pm, I noticed that we can use 
DeleteAttribute, so I tried:

Condition: On create
Action: User Defined
Template: Global Template: Blank
Stage: Transaction Create

Custom Condition:

Custom Action preparation Code: return 1;

Custom action cleanup code:

$self-TicketObj-DeleteAttribute('Requestor');



But nothing's actually happening, and the requestor is listed on the 
webui still. Is there a better way to do this? Am I even barking up the 
right tree? Thanks in advance for your help.



--
Chris Nelson


___
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) Deleting a requestor upon ticket creation.

2007-10-15 Thread Patterson, Craig
Chris,

We take a different approach that works pretty well.  We prevent
external emails being sent by filtering them out in our SendMail_Local
file.  Basically we only send emails that are verified against LDAP.  Of
course, a lot depends on how you determine who is external.  

Craig

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris
Nelson
Sent: Monday, October 15, 2007 4:40 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] (Scrip help) Deleting a requestor upon ticket
creation.

Hello list,

I have a rather strange request, I want to delete a requestor when a 
ticket is created.  Reason being, as the ticket is assigned to different

queues, replies to requestor are sent by the other queues, and that is 
usually not needed for external requests. The easiest way to address 
this would be to just remove the requestors on tickets created in that 
queue.


Looking at the perldoc for Record.pm, I noticed that we can use 
DeleteAttribute, so I tried:
Condition: On create
Action: User Defined
Template: Global Template: Blank
Stage: Transaction Create

Custom Condition:

Custom Action preparation Code: return 1;

Custom action cleanup code:

$self-TicketObj-DeleteAttribute('Requestor');



But nothing's actually happening, and the requestor is listed on the 
webui still. Is there a better way to do this? Am I even barking up the 
right tree? Thanks in advance for your help.


-- 
Chris Nelson


___
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) Deleting a requestor upon ticket creation.

2007-10-15 Thread Chris Nelson
I wish we could do that, but as it happens, that is the only queue that 
we don't want to send out RT replies from because the email that feeds 
that queue is an outward-facing public email (support@my company).  
All other queues, we want to be able to communicate owner changes, 
replies and such to the external addresses, because the external 
addresses coming into those other queues are there for a reason and are 
not advertised publicly.  So basically, whenever someone sends an email 
to support@my company (the email which feeds into the 
incoming-external queue), we want to create a ticket, but then remove 
the requestor so that the external address does not get communications 
that might (accidentally or not) be internal private communications.



Patterson, Craig wrote:

Chris,

We take a different approach that works pretty well.  We prevent
external emails being sent by filtering them out in our SendMail_Local
file.  Basically we only send emails that are verified against LDAP.  Of
course, a lot depends on how you determine who is external.  


Craig

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris
Nelson
Sent: Monday, October 15, 2007 4:40 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] (Scrip help) Deleting a requestor upon ticket
creation.

Hello list,

I have a rather strange request, I want to delete a requestor when a 
ticket is created.  Reason being, as the ticket is assigned to different


queues, replies to requestor are sent by the other queues, and that is 
usually not needed for external requests. The easiest way to address 
this would be to just remove the requestors on tickets created in that 
queue.



Looking at the perldoc for Record.pm, I noticed that we can use 
DeleteAttribute, so I tried:

Condition: On create
Action: User Defined
Template: Global Template: Blank
Stage: Transaction Create

Custom Condition:

Custom Action preparation Code: return 1;

Custom action cleanup code:

$self-TicketObj-DeleteAttribute('Requestor');



But nothing's actually happening, and the requestor is listed on the 
webui still. Is there a better way to do this? Am I even barking up the 
right tree? Thanks in advance for your help.



  



--
Chris Nelson




___
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) Deleting a requestor upon ticket creation.

2007-10-15 Thread Mathew
I do this with some of our tickets.  I'll post what I use in the morning
if someone else hasn't already.

Keep up with my goings on at http://theillien.blogspot.com

Chris Nelson wrote:
 Hello list,
 
 I have a rather strange request, I want to delete a requestor when a
 ticket is created.  Reason being, as the ticket is assigned to different
 queues, replies to requestor are sent by the other queues, and that is
 usually not needed for external requests. The easiest way to address
 this would be to just remove the requestors on tickets created in that
 queue.
 
 
 Looking at the perldoc for Record.pm, I noticed that we can use
 DeleteAttribute, so I tried:
 Condition: On create
 Action: User Defined
 Template: Global Template: Blank
 Stage: Transaction Create
 
 Custom Condition:
 
 Custom Action preparation Code: return 1;
 
 Custom action cleanup code:
 
 $self-TicketObj-DeleteAttribute('Requestor');
 
 
 
 But nothing's actually happening, and the requestor is listed on the
 webui still. Is there a better way to do this? Am I even barking up the
 right tree? Thanks in advance for your help.
 
 
___
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 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


[rt-users] Scrip help to replace requestor upon create

2007-06-18 Thread James Price
I am looking to do 1 of the following:
1. Have a scrip that removes the requestor on a specific queue if it matches
X, X of course being a specific email address.

2. A SQL query that will accomplish the above that I could run from a cron
job.

I have a MySQL query I thought would work, essentially the following:
/usr/local/mysql/bin/mysql -u dbauname rt3 -e update Tickets set
Creator='10' where Queue='7' and Creator='2653';

This does update the creator of a given ticket that matches userid 2653 and
changes it to userid 10, which is the nobody user.  Even though this works,
I must be missing something because there are still tickets with requestors
of the userid 2653 on the ticket and not Nobody.

An easier and more efficient way of doing this would be on creation using a
scrip.  I have a scrip which works which upon creation sets the owner
automatically.  I'm sure its just a slight modification to that scrip, but I
just can't quite find the object information I need.

My Change Owner scrip contains the following:
Condition: On Create
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate

Custom Condition: is blank
Custom action preparation code: return 1;
Custom action cleanup code: 
my $newowner = kera;
$self-TicketObj-SetOwner( $newowner );
return 1;


I'm sure if I knew the syntax to modify this to change the requestor on a
ticket, it'd be easier.  Essentially I want the requestor to be Nobody.

Thanks,
James


James R. Price
DigitalCiti.com
3636 S. Iron St., Chicago, IL 60609
Company Tel: 888.855.5550
My Tel/Fax/Cell: 800.603.0769
Web: www.digitalciti.com
Email: [EMAIL PROTECTED]


___
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 to replace requestor upon create

2007-06-18 Thread James Price
If anyone has an idea on this, essentially what I am doing now and
accomplishes what I want is the same as Bulk Update in a ticket query,
remove requestor.  Its possible from the GUI so it has to be possible via
scrip or SQL query via the API.

Thanks,
James

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of James Price
Sent: Monday, June 18, 2007 2:06 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Scrip help to replace requestor upon create

I am looking to do 1 of the following:
1. Have a scrip that removes the requestor on a specific queue if it matches
X, X of course being a specific email address.

2. A SQL query that will accomplish the above that I could run from a cron
job.

I have a MySQL query I thought would work, essentially the following:
/usr/local/mysql/bin/mysql -u dbauname rt3 -e update Tickets set
Creator='10' where Queue='7' and Creator='2653';

This does update the creator of a given ticket that matches userid 2653 and
changes it to userid 10, which is the nobody user.  Even though this works,
I must be missing something because there are still tickets with requestors
of the userid 2653 on the ticket and not Nobody.

An easier and more efficient way of doing this would be on creation using a
scrip.  I have a scrip which works which upon creation sets the owner
automatically.  I'm sure its just a slight modification to that scrip, but I
just can't quite find the object information I need.

My Change Owner scrip contains the following:
Condition: On Create
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate

Custom Condition: is blank
Custom action preparation code: return 1;
Custom action cleanup code: 
my $newowner = kera;
$self-TicketObj-SetOwner( $newowner );
return 1;


I'm sure if I knew the syntax to modify this to change the requestor on a
ticket, it'd be easier.  Essentially I want the requestor to be Nobody.

Thanks,
James


James R. Price
DigitalCiti.com
3636 S. Iron St., Chicago, IL 60609
Company Tel: 888.855.5550
My Tel/Fax/Cell: 800.603.0769
Web: www.digitalciti.com
Email: [EMAIL PROTECTED]


___
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