Custom condition for script

I have a couple users that can’t be trained to CC each other, and they need to be CC’d on everything they create, but they also aren’t the only ones creating to the queue so I can’t just set them as a watcher for the queue.

Basically I would like to check on create to see if they are one or the other user, and if they are then I would like to add their counterpart as a CC to the ticket. Basically some code that looks like this:

if(user=bob | bill) {
AddUserAsCCToTicket(bob&bill)
}

The bad news here is that I’m incredibly dumb when it comes to perl, and have no grasp at all of the syntax much less the methods to use.

I’m guessing I put stuff like this in scrips, but I’m not 100% and I’m not sure if that can be put entirely in the condition or if I need to put it in both the condition and the action…

Cheers

Miles Scruggs
miles@digitalphotobox.net

smime.p7s (4.78 KB)

anyone able to help on this one?On Tue, Apr 16, 2013 at 10:46 AM, Miles Scruggs miles@digitalphotobox.netwrote:

I have a couple users that can’t be trained to CC each other, and they
need to be CC’d on everything they create, but they also aren’t the only
ones creating to the queue so I can’t just set them as a watcher for the
queue.

Basically I would like to check on create to see if they are one or the
other user, and if they are then I would like to add their counterpart as a
CC to the ticket. Basically some code that looks like this:

if(user=bob | bill) {
AddUserAsCCToTicket(bob&bill)
}

The bad news here is that I’m incredibly dumb when it comes to perl, and
have no grasp at all of the syntax much less the methods to use.

I’m guessing I put stuff like this in scrips, but I’m not 100% and I’m not
sure if that can be put entirely in the condition or if I need to put it in
both the condition and the action…

Cheers

Miles Scruggs
miles@digitalphotobox.net

Cheers,

Miles

This should do what you want . It could be generalized to use groups or AdminCc. Create a scrip with

Condition = On Create
Action = User Defined
Template = Blank
Stage = TransactionCreate

In the Custom action preparation code box, insert:

Add other user as a Cc if ticket is created by either in the users list

my @users = (‘user0@mydomain.com’, ‘user1@mydomain.com’);
my $creator = $self->TransactionObj->CreatorObj->EmailAddress;
my $Ticket = $self->TicketObj;

if ($creator eq $users[0]) {
$Ticket->AddWatcher(Type => ‘Cc’, Email => $users[1]);
}
elsif ($creator eq $users[1]) {
$Ticket->AddWatcher(Type => ‘Cc’, Email => $users[0]);
}

In the Custom action cleanup code box, insert:
1;

– JimFrom: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Miles Scruggs
Sent: Monday, April 22, 2013 3:52 PM
To: RT users
Subject: Re: [rt-users] Custom condition for script

anyone able to help on this one?

Thanks Jim,

I think that has got me off and running now. About order of execution, from what I read it is alphabetical, does that group queue specific scripts in with the globals and then order them?

Cheers

Miles Scruggs
miles@digitalphotobox.netOn Apr 23, 2013, at 10:01 AM, Jim Berry jim.h.berry@frb.gov wrote:

This should do what you want . It could be generalized to use groups or AdminCc. Create a scrip with

Condition = On Create
Action = User Defined
Template = Blank
Stage = TransactionCreate

In the Custom action preparation code box, insert:

Add other user as a Cc if ticket is created by either in the users list

my @users = (‘user0@mydomain.com’, ‘user1@mydomain.com’);
my $creator = $self->TransactionObj->CreatorObj->EmailAddress;
my $Ticket = $self->TicketObj;

if ($creator eq $users[0]) {
$Ticket->AddWatcher(Type => ‘Cc’, Email => $users[1]);
}
elsif ($creator eq $users[1]) {
$Ticket->AddWatcher(Type => ‘Cc’, Email => $users[0]);
}

In the Custom action cleanup code box, insert:
1;

– Jim

From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Miles Scruggs
Sent: Monday, April 22, 2013 3:52 PM
To: RT users
Subject: Re: [rt-users] Custom condition for script

anyone able to help on this one?

On Tue, Apr 16, 2013 at 10:46 AM, Miles Scruggs miles@digitalphotobox.net wrote:
I have a couple users that can’t be trained to CC each other, and they need to be CC’d on everything they create, but they also aren’t the only ones creating to the queue so I can’t just set them as a watcher for the queue.

Basically I would like to check on create to see if they are one or the other user, and if they are then I would like to add their counterpart as a CC to the ticket. Basically some code that looks like this:

if(user=bob | bill) {
AddUserAsCCToTicket(bob&bill)
}

The bad news here is that I’m incredibly dumb when it comes to perl, and have no grasp at all of the syntax much less the methods to use.

I’m guessing I put stuff like this in scrips, but I’m not 100% and I’m not sure if that can be put entirely in the condition or if I need to put it in both the condition and the action…

Cheers

Miles Scruggs
miles@digitalphotobox.net


Cheers,

Miles

smime.p7s (4.78 KB)

Yes.From: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Miles Scruggs
Sent: Tuesday, April 23, 2013 5:54 PM
To: RT users
Subject: Re: [rt-users] Custom condition for script

Thanks Jim,

I think that has got me off and running now. About order of execution, from what I read it is alphabetical, does that group queue specific scripts in with the globals and then order them?

Cheers

Miles Scruggs
miles@digitalphotobox.netmailto:miles@digitalphotobox.net