Re: [rt-users] Question on custom scrip condition

2009-06-23 Thread Ken Crocker

Kevin,

You can get the Id thus:
my $Corresponder = $self-TransactionObj-CreatorObj-PrincipalId;
and you can check if it is nobody against $RT::Nobody-Id.
Maybe someone else on the list can help you with the check for privileged.

As for why an Email goes out or not, that depends on:

  1. valid scrip condition  action
  2. valid UserID as recipient (must be privileged and has rights to
 queue sending out Email).


Kenn
LBNL

On 6/22/2009 4:16 PM, Kevin Gagel wrote:
Yeah, I hadn't considered that. But in that case then it shouldn't try 
to send the email. So it'll need a check for the owner and if the 
owner is not nobody then send the message. Still, I don't know how to 
do either of those checks, for the owner and then to ensure it sends 
an email.


Any pointers?


Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel


--- Original message ---
Subject: Re: [rt-users] Question on custom scrip condition
From: Ken Crocker kfcroc...@lbl.gov
To: Kevin Gagel ga...@cnc.bc.ca
Cc: RT-Users@lists.bestpractical.com
Date: 22/06/2009 3:24 PM

Kevin,

What if the ticket is created WITHOUT an owner?

Kenn
LBNL

On 6/22/2009 2:57 PM, Kevin Gagel wrote:

Thanks Ken for the script. I've altered Ken's script to this:
my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
if  ($trans-Type eq 'CustomField')
{my $cf = new RT::CustomField($RT::SystemUser);
$cf-LoadByName(Queue = $ticket-QueueObj-id,
 Name = 'Urgency');
 return 0 unless $cf-id;
 if  ($trans-Field == $cf-id  $trans-NewValue eq 'URGENT')
  {
  $RT::Logger-debug('.');
  $RT::Logger-debug('It is an URGENT ticket so send the 
owner a message.');

  $RT::Logger-debug('.');
  return 1;
  }
 else
{
$RT::Logger-debug('.');
$RT::Logger-debug('Fell through the check and into the else.');
$RT::Logger-debug('.');
}
}

return 0;
===
The debug output shows it is doing what's expected but I am not 
receiving an email. The debug output indicates that no recipients 
were found. So... How do I correct that?
I want the owner of the ticket to be notified by email if a ticket is 
created with an URGENT status or if the status changes to URGENT.


Actual debug output:
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for 
attribute creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: Working on mailfield Bcc; 
recipients are  (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:650)
[Mon Jun 22 21:51:02 2009] [debug]: Subject: [Email Issue: #165] 
URGENT: URGENT

From: Kevin W. Gagel via RT r...@xx.bc.ca
Reply-To: r...@xx.bc.ca
Message-ID: rt-3.8.2-19683-1245707462-1931.165-1...@cnc IT Services
Precedence: bulk
X-RT-Loop-Prevention: CNC's Ticket System
RT-Ticket: CNC's Ticket System #165
Managed-by: RT 3.8.2 (http://www.bestpractical.com/rt/)
RT-Originator: ga...@xx.bc.ca
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8
X-RT-Original-Encoding: utf-8 
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:657)
[Mon Jun 22 21:51:02 2009] [debug]: Removing deferred recipients from 
Bcc: line (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:680)
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for 
attribute creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: No recipients found for deferred 
delivery on transaction #2236 
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:702)



Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel


--- Original message ---
Subject: Re: [rt-users] Question on custom scrip condition
From: Ken Crocker kfcroc...@lbl.gov
To: Kevin Gagel ga...@cnc.bc.ca
Cc: RT Users RT-Users@lists.bestpractical.com
Date: 16/06/2009 3:56 PM

Kevin,


Here's one we use for when the development step of a ticket (CF 
Work-State) is changed to Review Approved:


# condition execution on CF Review Process

my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;

if  ($trans-Type eq 'CustomField')
{my $cf = new RT::CustomField($RT::SystemUser);
$cf-LoadByName(Queue = $ticket-QueueObj-id,
 Name = Work-State);
 return 0 unless $cf-id; 
 if  ($trans-Field == $cf-id 

  $trans-NewValue eq Review Complete-Approved)
  {
   return 1;
  }
}

return 0;

Just plug in your CF name and value you want and you're set. Hope 
this helps.


Kenn
LBNL

On 6/16/2009 2:53 PM, Kevin Gagel wrote:
My users don't want to use priorities so they've had me create 4 
levelsfor urgency. They only want to be notified by email on an item 
that hasthe highest urgency level set. So I want to setup a custom 
conditionthat tests for that level

Re: [rt-users] Question on custom scrip condition

2009-06-22 Thread Kevin Gagel
Thanks Ken for the script. I've altered Ken's script to this:
my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
if  ($trans-Type eq 'CustomField')
{my $cf = new RT::CustomField($RT::SystemUser);
$cf-LoadByName(Queue = $ticket-QueueObj-id,
 Name = 'Urgency');
 return 0 unless $cf-id;
 if  ($trans-Field == $cf-id ic $trans-NewValue eq 'URGENT')
  {
  $RT::Logger-debug('.');
  $RT::Logger-debug('It is an URGENT ticket so send the owner a 
message.');
  $RT::Logger-debug('.');
  return 1;
  }
 else
{
$RT::Logger-debug('.');
$RT::Logger-debug('Fell through the check and into the else.');
$RT::Logger-debug('.');
}
}

return 0;
===
The debug output shows it is doing what's expected but I am not receiving an 
email. The debug output indicates that no recipients were found. So... How do I 
correct that?
I want the owner of the ticket to be notified by email if a ticket is created 
with an URGENT status or if the status changes to URGENT.

Actual debug output:
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for attribute 
creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: Working on mailfield Bcc; recipients are  
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:650)
[Mon Jun 22 21:51:02 2009] [debug]: Subject: [Email Issue: #165] URGENT: URGENT
From: Kevin W. Gagel via RT r...@xx.bc.ca
Reply-To: r...@xx.bc.ca
Message-ID: rt-3.8.2-19683-1245707462-1931.165-1...@cnc IT Services
Precedence: bulk
X-RT-Loop-Prevention: CNC's Ticket System
RT-Ticket: CNC's Ticket System #165
Managed-by: RT 3.8.2 (http://www.bestpractical.com/rt/)
RT-Originator: ga...@xx.bc.ca
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8
X-RT-Original-Encoding: utf-8 (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:657)
[Mon Jun 22 21:51:02 2009] [debug]: Removing deferred recipients from Bcc: line 
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:680)
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for attribute 
creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: No recipients found for deferred delivery 
on transaction #2236 (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:702)


Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel


--- Original message ---
Subject: Re: [rt-users] Question on custom scrip condition
From: Ken Crocker kfcroc...@lbl.gov
To: Kevin Gagel ga...@cnc.bc.ca
Cc: RT Users RT-Users@lists.bestpractical.com
Date: 16/06/2009 3:56 PM


Kevin,


Here's one we use for when the development step of a ticket (CF Work-State) 
is changed to Review Approved:

# condition execution on CF Review Process

my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;

if  ($trans-Type eq 'CustomField')
{my $cf = new RT::CustomField($RT::SystemUser);
$cf-LoadByName(Queue = $ticket-QueueObj-id,
 Name = Work-State);
 return 0 unless $cf-id;
 if  ($trans-Field == $cf-id ic
  $trans-NewValue eq Review Complete-Approved)
  {
   return 1;
  }
}

return 0;

Just plug in your CF name and value you want and you're set. Hope this helps.

Kenn
LBNL

On 6/16/2009 2:53 PM, Kevin Gagel wrote:My users don't want to use 
priorities so they've had me create 4 levelsfor urgency. They only want to be 
notified by email on an item that hasthe highest urgency level set. So I want 
to setup a custom conditionthat tests for that level and then sends an email to 
the user if thatspecific level is set.

So, I have a custom field of Urgency which can have a value of URGENT, High, 
Medium, Low, or Project.
I have the template made already for the email to be sent out and thescrip 
configured for it. I just don't know how to write the customcondition to put 
into the scrip. How do I write the condition to test for URGENT and indicate 
the action to send the email?

All the references I'm finding in the RT Essentials have me a bit confused, am 
I supposed to right a new module to make this scrip or can I just add the perl 
code to the condition (not that I know what code I have to enter just yet).

Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel




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

Community help

Re: [rt-users] Question on custom scrip condition

2009-06-22 Thread Ken Crocker

Kevin,

What if the ticket is created WITHOUT an owner?

Kenn
LBNL

On 6/22/2009 2:57 PM, Kevin Gagel wrote:

Thanks Ken for the script. I've altered Ken's script to this:
my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
if  ($trans-Type eq 'CustomField')
{my $cf = new RT::CustomField($RT::SystemUser);
$cf-LoadByName(Queue = $ticket-QueueObj-id,
 Name = 'Urgency');
 return 0 unless $cf-id;
 if  ($trans-Field == $cf-id  $trans-NewValue eq 'URGENT')
  {
  $RT::Logger-debug('.');
  $RT::Logger-debug('It is an URGENT ticket so send the owner 
a message.');

  $RT::Logger-debug('.');
  return 1;
  }
 else
{
$RT::Logger-debug('.');
$RT::Logger-debug('Fell through the check and into the else.');
$RT::Logger-debug('.');
}
}

return 0;
===
The debug output shows it is doing what's expected but I am not 
receiving an email. The debug output indicates that no recipients were 
found. So... How do I correct that?
I want the owner of the ticket to be notified by email if a ticket is 
created with an URGENT status or if the status changes to URGENT.


Actual debug output:
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for 
attribute creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: Working on mailfield Bcc; 
recipients are  (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:650)
[Mon Jun 22 21:51:02 2009] [debug]: Subject: [Email Issue: #165] 
URGENT: URGENT

From: Kevin W. Gagel via RT r...@xx.bc.ca
Reply-To: r...@xx.bc.ca
Message-ID: rt-3.8.2-19683-1245707462-1931.165-1...@cnc IT Services
Precedence: bulk
X-RT-Loop-Prevention: CNC's Ticket System
RT-Ticket: CNC's Ticket System #165
Managed-by: RT 3.8.2 (http://www.bestpractical.com/rt/)
RT-Originator: ga...@xx.bc.ca
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8
X-RT-Original-Encoding: utf-8 
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:657)
[Mon Jun 22 21:51:02 2009] [debug]: Removing deferred recipients from 
Bcc: line (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:680)
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for 
attribute creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: No recipients found for deferred 
delivery on transaction #2236 
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:702)



Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel


--- Original message ---
Subject: Re: [rt-users] Question on custom scrip condition
From: Ken Crocker kfcroc...@lbl.gov
To: Kevin Gagel ga...@cnc.bc.ca
Cc: RT Users RT-Users@lists.bestpractical.com
Date: 16/06/2009 3:56 PM

Kevin,


Here's one we use for when the development step of a ticket (CF 
Work-State) is changed to Review Approved:


# condition execution on CF Review Process

my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;

if  ($trans-Type eq 'CustomField')
{my $cf = new RT::CustomField($RT::SystemUser);
$cf-LoadByName(Queue = $ticket-QueueObj-id,
 Name = Work-State);
 return 0 unless $cf-id; 
 if  ($trans-Field == $cf-id 

  $trans-NewValue eq Review Complete-Approved)
  {
   return 1;
  }
}

return 0;

Just plug in your CF name and value you want and you're set. Hope this 
helps.


Kenn
LBNL

On 6/16/2009 2:53 PM, Kevin Gagel wrote:
My users don't want to use priorities so they've had me create 4 
levelsfor urgency. They only want to be notified by email on an item 
that hasthe highest urgency level set. So I want to setup a custom 
conditionthat tests for that level and then sends an email to the 
user if thatspecific level is set.


So, I have a custom field of Urgency which can have a value of 
URGENT, High, Medium, Low, or Project.
I have the template made already for the email to be sent out and 
thescrip configured for it. I just don't know how to write the 
customcondition to put into the scrip. How do I write the condition 
to test for URGENT and indicate the action to send the email?


All the references I'm finding in the RT Essentials have me a bit 
confused, am I supposed to right a new module to make this scrip or 
can I just add the perl code to the condition (not that I know what 
code I have to enter just yet).


Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel


 

 
___ 
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

Re: [rt-users] Question on custom scrip condition

2009-06-22 Thread Kevin Gagel
Yeah, I hadn't considered that. But in that case then it shouldn't try to send 
the email. So it'll need a check for the owner and if the owner is not nobody 
then send the message. Still, I don't know how to do either of those checks, 
for the owner and then to ensure it sends an email.

Any pointers?


Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel


--- Original message ---
Subject: Re: [rt-users] Question on custom scrip condition
From: Ken Crocker kfcroc...@lbl.gov
To: Kevin Gagel ga...@cnc.bc.ca
Cc:  RT-Users@lists.bestpractical.com
Date: 22/06/2009 3:24 PM


Kevin,

What if the ticket is created WITHOUT an owner?

Kenn
LBNL

On 6/22/2009 2:57 PM, Kevin Gagel wrote:   Thanks Ken for the script. I've 
altered Ken's script to this:
my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
if  ($trans-Type eq 'CustomField')
{my $cf = new RT::CustomField($RT::SystemUser);
$cf-LoadByName(Queue = $ticket-QueueObj-id,
 Name = 'Urgency');
 return 0 unless $cf-id;
 if  ($trans-Field == $cf-id ic $trans-NewValue eq 'URGENT')
  {
  $RT::Logger-debug('.');
  $RT::Logger-debug('It is an URGENT ticket so send the owner a 
message.');
  $RT::Logger-debug('.');
  return 1;
  }
 else
{
$RT::Logger-debug('.');
$RT::Logger-debug('Fell through the check and into the else.');
$RT::Logger-debug('.');
}
}

return 0;
===
The debug output shows it is doing what's expected but I am not receiving an 
email. The debug output indicates that no recipients were found. So... How do I 
correct that?
I want the owner of the ticket to be notified by email if a ticket is created 
with an URGENT status or if the status changes to URGENT.

Actual debug output:
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for attribute 
creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: Working on mailfield Bcc; recipients are  
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:650)
[Mon Jun 22 21:51:02 2009] [debug]: Subject: [Email Issue: #165] URGENT: URGENT
From: Kevin W. Gagel via RT r...@xx.bc.ca
Reply-To: r...@xx.bc.ca
Message-ID: rt-3.8.2-19683-1245707462-1931.165-1...@cnc IT Services
Precedence: bulk
X-RT-Loop-Prevention: CNC's Ticket System
RT-Ticket: CNC's Ticket System #165
Managed-by: RT 3.8.2 (http://www.bestpractical.com/rt/)
RT-Originator:ga...@xx.bc.ca
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=utf-8
X-RT-Original-Encoding: utf-8 (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:657)
[Mon Jun 22 21:51:02 2009] [debug]: Removing deferred recipients from Bcc: line 
(/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:680)
[Mon Jun 22 21:51:02 2009] [debug]: Setting deferred recipients for attribute 
creation (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:689)
[Mon Jun 22 21:51:02 2009] [debug]: No recipients found for deferred delivery 
on transaction #2236 (/opt/rt3/bin/../lib/RT/Action/SendEmail.pm:702)


Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel


--- Original message ---
Subject: Re: [rt-users] Question on custom scrip condition
From: Ken Crockerkfcroc...@lbl.gov
To: Kevin Gagelga...@cnc.bc.ca
Cc: RT UsersRT-Users@lists.bestpractical.com
Date: 16/06/2009 3:56 PM


Kevin,


Here's one we use for when the development step of a ticket (CF Work-State) 
is changed to Review Approved:

# condition execution on CF Review Process

my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;

if  ($trans-Type eq 'CustomField')
{my $cf = new RT::CustomField($RT::SystemUser);
$cf-LoadByName(Queue = $ticket-QueueObj-id,
 Name = Work-State);
 return 0 unless $cf-id;
 if  ($trans-Field == $cf-id ic
  $trans-NewValue eq Review Complete-Approved)
  {
   return 1;
  }
}

return 0;

Just plug in your CF name and value you want and you're set. Hope this helps.

Kenn
LBNL

On 6/16/2009 2:53 PM, Kevin Gagel wrote:My users don't want to use priorities 
so they've had me create 4 levelsfor urgency. They only want to be notified by 
email on an item that hasthe highest urgency level set. So I want to setup a 
custom conditionthat tests for that level and then sends an email to the user 
if thatspecific level is set.

So, I have a custom field of Urgency which can have a value of URGENT, High, 
Medium, Low, or Project.
I have the template made already for the email to be sent out and thescrip 
configured for it. I just don't know how to write the customcondition to put 
into the scrip. How do I write the condition to test for URGENT and indicate 
the action to send the email?

All the references I'm finding in the RT Essentials have me

[rt-users] Question on custom scrip condition

2009-06-16 Thread Kevin Gagel
My users don't want to use priorities so they've had me create 4 levels for 
urgency. They only want to be notified by email on an item that has the highest 
urgency level set. So I want to setup a custom condition that tests for that 
level and then sends an email to the user if that specific level is set.

 So, I have a custom field of Urgency which can have a value of URGENT, High, 
Medium, Low, or Project.
 I have the template made already for the email to be sent out and the scrip 
configured for it. I just don't know how to write the custom condition to put 
into the scrip. How do I write the condition to test for URGENT and indicate 
the action to send the email?

All the references I'm finding in the RT Essentials have me a bit confused, am 
I supposed to right a new module to make this scrip or can I just add the perl 
code to the condition (not that I know what code I have to enter just yet).

Kevin W. Gagel
Network Administrator
Local 5448
My blog:
http://mail.cnc.bc.ca/blogs/gagel
My shared files:
http://mail.cnc.bc.ca/users/gagel



___
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