Accessing role object from template

Hi all,

I’ve created a custom role “Transfer Operators” and i wanted to email
all those people from a scrip/template, but i have found that the
argument in ScripActions cannot take a word boundary - renaming the role
to TransferOperators and the argument in ScripActions sends a mail.

It would seem that either Role Names need to be restricted to single
words, or Notify.pm needs an update to cope with spaces in Role Names

My question is however, how can i access Role member info from a template

something like:

{ $Ticket->RoleObj(“TransferOperators”)->RealName }

w.

Richard Wood (Woody)
Managing Director
Wild Thing Safaris Ltd.

UK: 2B Habbo St, Greenwich, London
Dar es Salaam: 5 Ethan St, Mbezi beach
Arusha: 3 Ebeneezer Rd, Njiro
PO BOX 34514 DSM
Office: +255 (0) 222 617 166
Office Mobile: +255 (0) 773 503 502
Direct: +255 742 373 327
Skype: woody1tz
http://wildthingsafaris.com

Hi all,

Hi Woody,

I’ve created a custom role “Transfer Operators” and i wanted to email
all those people from a scrip/template, but i have found that the
argument in ScripActions cannot take a word boundary - renaming the role
to TransferOperators and the argument in ScripActions sends a mail.

One workaround would be to use the RT::CustomRole-1 syntax (where 1 is the role’s ID) in the ScripAction argument.

I’ve made a ticket for adjusting how the argument parsing works, since you’re right, that is a bit limiting: https://issues.bestpractical.com/Ticket/Display.html?id=31997

It would seem that either Role Names need to be restricted to single
words, or Notify.pm needs an update to cope with spaces in Role Names

My question is however, how can i access Role member info from a template

something like:

{ $Ticket->RoleObj(“TransferOperators”)->RealName }

Two options:

Load the role by name:

my $role = RT::CustomRole->new($CurrentUser);
$role->Load(“TransferOperators”);
$Ticket->RoleGroup($role->GroupType);

or specify the internal ID directly:

$Ticket->RoleGroup(“RT::CustomRole-1”);

This will return an RT::Group object. If you only need email address(es), you can use $Ticket->RoleAddresses(“RT::CustomRole-1”) directly.

w.

By the way, we’d love to hear more about how you’re using custom roles :slight_smile:

Thanks!
Shawn