Re: [rt-users] accessing role object from template

2016-05-23 Thread Shawn Moore
On 2016年5月21日 at 3:21:17, Woody - Wild Thing Safaris 
(wo...@wildthingsafaris.com) wrote:
> 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 :)

Thanks!
Shawn
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016


[rt-users] accessing role object from template

2016-05-21 Thread Woody - Wild Thing Safaris

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

-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Washington DC - May 23 & 24, 2016