Scrip Issue: Notify other recipients if not created by queue manager

Greetings,

This one has been stumping me for a week now so I figure it’s time
to ask for help. I am trying to create two scrips, neither of which I
can get to work. The first and more important is to notify “other
recipients” only if the ticket was not submitted by a member of the
queue managers group for the appropriate queue.

I.E. A user submits a ticket in the ServerAdmin queue, the queue
managers for that queue get notified. However, if I submit a ticket in
that queue, the rest of the queue managers should not be notified.
Notifying the group is not an issue, however whenever I submit a
ticket it still causes notification. The User Defined condition I have
is:

if ($self->TransactionObj->Type eq ‘Create’) {
my $GroupObj = RT::Group->new( $RT::SystemUser );
$GroupObj->LoadUserDefinedGroup( $self->TicketObj->QueueObj->Name );
if ($GroupObj->HasMemberRecursively( $self->CurrentUser->PrincipalObj )) {
return 0;
}
return 1;
}

The LoadUserDefinedGroup paramater should be correct – I have the
group for queue managers named identical to the queue.

Thanks,
Matt Brennan

Greetings,

This one has been stumping me for a week now so I figure it’s time
to ask for help. I am trying to create two scrips, neither of which I
can get to work. The first and more important is to notify “other
recipients” only if the ticket was not submitted by a member of the
queue managers group for the appropriate queue.

I.E. A user submits a ticket in the ServerAdmin queue, the queue
managers for that queue get notified. However, if I submit a ticket in
that queue, the rest of the queue managers should not be notified.
Notifying the group is not an issue, however whenever I submit a
ticket it still causes notification. The User Defined condition I have
is:

if ($self->TransactionObj->Type eq ‘Create’) {
my $GroupObj = RT::Group->new( $RT::SystemUser );
$GroupObj->LoadUserDefinedGroup( $self->TicketObj->QueueObj->Name );
if ($GroupObj->HasMemberRecursively( $self->CurrentUser->PrincipalObj )) {

You should $RT::Logger->error() out $self->CurrentUser information, it
isn’t who you think it is.

$self->TransactionObj->CreatorObj->PrincipalObj is likely to be closer
to what you want

-kevin

Matt,

I’m not sure I got this right, but it sounds like the “others” are NOT
getting a notification when the “Requestor” is NOT a member in the specified
Admin Group. Ticket correspondence can be a little difficult to deal with,
but remembering a few concepts will help:

  1. Queue Watcher “Cc’s” and Ticket “Cc’s” are NOT considered "Others"
    by RT. They will always be “Cc’s” as far as recipients of correspondence sent
    by RT
    .
  2. “Others” are always an email address or a UserID you enter into or add to
    the “Cc” line at the moment of creating a “reply” from a ticket (or an email
    address you have in a template).
  3. RT always executes scrips in alphabetical order by name.

Therefore, at the time of ticket creation, there is no “Other” person to
receive an email notification from that initial creation, unless you have a
template that overrides “To:” with some address you create from
transaction/ticket data (including a Custom Field). Perhaps you want your
scrip to “Notify Cc’s”?

I have a scrip that takes the members of a group and adds them to the "Cc"
list of a ticket (based on certain conditions), so they will be considered
as “Cc’s” for any correspondence from that ticket. It’s important to
understand the timing of the execution of these scrips (# 3 above). I add
these “Cc’s” in the Custom Prep Code section AND I make sure that the
execution of the scrip is alphabetically sequenced before any notification
scrip
could be triggered. I name all my scrips that add/modify data in
tickets/transactions with a number followed by a letter (ie. 1a, 1b, 1c)
that way all the 1a’s get executed before any 1b’s or 1c’s and definitely
before any “Notify xxx”.

Therefore, I have a scrip that add’s “Cc’s” to the ticket named “1b Add
Group to Cc” (“1b” because I have some other “1a” scrips I want executed
before it) and then another scrip that is named “Notify Cc’s on Create”. The
"1b" scrip gets executed first, adding “Cc’s” to the ticket info and then
the “Notify Cc’s” scrip will be triggered and every address that is
listed
as a Queue or Ticket “Cc” will get the notification. Viola’.

Obviously, you will want to have a custom condition to NOT send a
notification based on your requirements, but I think you can get the "gist"
of what I’m explaining and use it.

Hope this helps.

Kenn
LBNLOn Fri, Jul 15, 2011 at 2:36 PM, Matt Brennan brennanma@gmail.com wrote:

Greetings,

This one has been stumping me for a week now so I figure it’s time
to ask for help. I am trying to create two scrips, neither of which I
can get to work. The first and more important is to notify “other
recipients” only if the ticket was not submitted by a member of the
queue managers group for the appropriate queue.

I.E. A user submits a ticket in the ServerAdmin queue, the queue
managers for that queue get notified. However, if I submit a ticket in
that queue, the rest of the queue managers should not be notified.
Notifying the group is not an issue, however whenever I submit a
ticket it still causes notification. The User Defined condition I have
is:

if ($self->TransactionObj->Type eq ‘Create’) {
my $GroupObj = RT::Group->new( $RT::SystemUser );
$GroupObj->LoadUserDefinedGroup( $self->TicketObj->QueueObj->Name );
if ($GroupObj->HasMemberRecursively( $self->CurrentUser->PrincipalObj )) {
return 0;
}
return 1;
}

The LoadUserDefinedGroup paramater should be correct – I have the
group for queue managers named identical to the queue.

Thanks,
Matt Brennan


2011 Training: http://bestpractical.com/services/training.html

Kevin,

That was exactly my issue. Thank you.

-MattOn Mon, Jul 18, 2011 at 11:11, Kevin Falcone falcone@bestpractical.com wrote:

On Fri, Jul 15, 2011 at 05:36:30PM -0400, Matt Brennan wrote:

Greetings,

This one has been stumping me for a week now so I figure it’s time
to ask for help. I am trying to create two scrips, neither of which I
can get to work. The first and more important is to notify “other
recipients” only if the ticket was not submitted by a member of the
queue managers group for the appropriate queue.

I.E. A user submits a ticket in the ServerAdmin queue, the queue
managers for that queue get notified. However, if I submit a ticket in
that queue, the rest of the queue managers should not be notified.
Notifying the group is not an issue, however whenever I submit a
ticket it still causes notification. The User Defined condition I have
is:

if ($self->TransactionObj->Type eq ‘Create’) {
my $GroupObj = RT::Group->new( $RT::SystemUser );
$GroupObj->LoadUserDefinedGroup( $self->TicketObj->QueueObj->Name );
if ($GroupObj->HasMemberRecursively( $self->CurrentUser->PrincipalObj )) {

You should $RT::Logger->error() out $self->CurrentUser information, it
isn’t who you think it is.

$self->TransactionObj->CreatorObj->PrincipalObj is likely to be closer
to what you want

-kevin

return 0;

}
return 1;
}

The LoadUserDefinedGroup paramater should be correct – I have the
group for queue managers named identical to the queue.

Thanks,
Matt Brennan


2011 Training: http://bestpractical.com/services/training.html


2011 Training: http://bestpractical.com/services/training.html