[rt-users] Custom condition for script

Jim Berry jim.h.berry at frb.gov
Tue Apr 23 13:01:58 EDT 2013


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 at mydomain.com', 'user1 at 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 at lists.bestpractical.com [mailto:rt-users-bounces at 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 at digitalphotobox.net<mailto:miles at 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 at digitalphotobox.net<mailto:miles at digitalphotobox.net>




--
Cheers,

Miles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130423/9d8a10aa/attachment.htm>


More information about the rt-users mailing list