Adding new users and CC users to tickets

Hello,

We are using RT 3.4.5.

I would be grateful for the list’s help on the following:

We have the following scenario:

  1. User A opens a ticket via email. We reply via email and User A
    forwards the message via email to User B.

User B now replies to the ticket using our rt address and the
correspondence is added to the ticket.

But, user B does not receive updates to the ticket when we reply via email.

How can we set it up such that user B is added automatically as an
additional requestor or CC ?

  1. User A opens a ticket via email and specifies a bunch of CC’s in the
    email.

How can I add all email CC fields as CC’s to the ticket ?

Thanks,
Shiv

Hi RT Users,

i’m just fighting with a scrip exec order. So far i remember, we can
fire up scrips from UI in a sort order (beginning from 3.6.0??)

No i have the problem that i need at create time 3 actions to be done.

There are no global Scrips defined, only on this queue.

From the flow:

A new mail reaches this queue, then:

  1. Set a CF (PM) to a default value (Value = ?)
  2. Parse the incoming mail for a specific value and put this into CF
    (PM)
  3. Send mail to AdminCC’s with modified Subject line with the Content of
    PM

All this scrips are triggering OnCreate, but now funny things start, the
mail sent to the AdminCC’s are fired before the other Scrips are
running.

My Scrips look like this:

Scrip 1:

001_SetDefaultValueForPM (On Create User Defined with template Blank)

Custom Action Prep Code: return 1;
Custom Action Cleanup Code:

my $CFName = ‘PM’;
my $DefaultValue = ‘PM?’;
my $RecTransaction = 1;

my $QueueObj = $self->TicketObj->QueueObj;
my $CFObj = RT::CustomField->new( $QueueObj->CurrentUser );
$CFObj->LoadByNameAndQueue( Name => $CFName, Queue => $QueueObj->id );
unless( $CFObj->id ) {
$CFObj->LoadByNameAndQueue( Name => $CFName, Queue => 0 );
unless( $CFObj->id ) {
$RT::Logger->warning(“custom field ‘$CFName’ isn’t global or
defined for queue '”. $QueueObj->Name ."’");
return undef;
}
}

unless( $self->TicketObj->FirstCustomFieldValue( $CFObj->id ) ) {
my( $st, $msg ) = $self->TicketObj->AddCustomFieldValue(
Field => $CFObj->id,
Value => $DefaultValue,
RecordTransaction =>
$RecTransaction );
unless( $st ) {
$RT::Logger->warning( “Couldn’t set $DefaultValue as value for CF
$CFName:”. $msg );
return undef;
}
}
return 1;

Scrip 2:

002_ScanForPM (On Create Extract Custom Field Values with template
ScanForPM)

Template: ScanForPM
Content: PM|Body|#(PM\w+)#||q

Scrip 3:

999_InformAdminCC (On Create Notify AdminCcs with template
CreateNewTicket)

Template: CreateNewTicket

Content:

RT-Attach-Message: yes

{$Transaction->Content()}

Each Scrip alone works well, but all together working but not like
expacted. Any Ideas? What’s wrong with this?

Help needed :wink:

Thanks

Torsten

Hello,

We are using RT 3.4.5.

I would be grateful for the list’s help on the following:

We have the following scenario:

  1. User A opens a ticket via email. We reply via email and User A
    forwards the message via email to User B.

User B now replies to the ticket using our rt address and the
correspondence is added to the ticket.

But, user B does not receive updates to the ticket when we reply via email.

How can we set it up such that user B is added automatically as an
additional requestor or CC ?

We do it with a custom global scrip, we called AddWatchersOnCorrespond.
Besides the sender, it will also add any additional people that the
correspondence was sent to. We also have a “General” queue and
associated group which includes all admins, and if the correspondence
includes one of these admins who is not already watching the ticket,
then they are added as an AdminCc instead of a Cc.

Condition: On Correspond
Action: User Defined

Custom action preparation code:
return 1;

Custom action cleanup code:

Get some info:

my $scrip = ‘Scrip:AddWatchersOnCorrespond’;
my $Transaction = $self->TransactionObj;
my $EmailAddr = $self->TransactionObj->CreatorObj->EmailAddress;
my $Queue = $self->TicketObj->QueueObj;
my $Ticket = $self->TicketObj;
my $Id = $self->TicketObj->id;

Extract a list of people associated with this transaction:

- including the transaction creator, and if it is an email, the sender and recipients of that email message.

my @People = ($EmailAddr);
foreach my $h (qw(From To Cc)) {
my $header = $Transaction->Attachments->First->GetHeader($h);
my @addr = Mail::Address->parse($header);
foreach my $addrobj (@addr) {
my $addr = lc $RT::Nobody->UserObj->CanonicalizeEmailAddress($addrobj->address);
# Ignore the specific addresses for this queue:
next if lc $Queue->CorrespondAddress eq $addr or lc $Queue->CommentAddress eq $addr;
# Ignore any email address that looks like one for any of our queues:
next if RT::EmailParser::IsRTAddress(’’, $addr);
$RT::Logger->debug("$scrip: Ticket #$Id correspondence contains header - $h: $addr");
push @People, $addr;
}
}

Lookup the ‘experts’ (general) group to use below:

my $Experts = RT::Group->new($self->CurrentUser);
$Experts->LoadUserDefinedGroup(‘general’);

Now check if each user is already watching the ticket or queue:

foreach my $addr (@People) {
my $User = RT::User->new($RT::SystemUser);
$User->LoadByEmail($addr);
my $Name = $User->Name;
my $Principal = $User->PrincipalId if $User->Id;
if (not ($Queue->IsWatcher(Type => ‘Cc’, PrincipalId => $Principal) or
$Queue->IsWatcher(Type => ‘AdminCc’, PrincipalId => $Principal) or
$Ticket->IsWatcher(Type => ‘Cc’, PrincipalId => $Principal) or
$Ticket->IsWatcher(Type => ‘AdminCc’, PrincipalId => $Principal) or
$Ticket->IsWatcher(Type => ‘Requestor’, PrincipalId => $Principal)
)) {
# If the user is a member of the experts group, then add them as an AdminCc, otherwise as a normal Cc:
my $type = $Experts->HasMember($User->PrincipalObj) ? ‘AdminCc’ : ‘Cc’;
# Add the new watcher now and check for errors:
my ($ret, $msg) = $Ticket->AddWatcher(Type => $type,
Email => $addr,
PrincipalId => $Principal,);
if ($ret) {
$RT::Logger->info("$scrip: New $type watcher added to ticket #$Id: $addr (#$Principal)");
} else {
$RT::Logger->error("$scrip: Failed to add new $type watcher to ticket #$Id: $addr (#$Principal) - $msg");
}
}
}

return 1;

  1. User A opens a ticket via email and specifies a bunch of CC’s in the
    email.

How can I add all email CC fields as CC’s to the ticket ?

Look in the RT_SiteConfig.pm file for this option:

$ParseNewMessageForTicketCcs

and don’t forget to set this option as well:

$RTAddressRegexp

~Jason