Hi all, I’m trying to use custom role in a script, but i’m unable to get value to insert in another field.
Exactly, i’m trying to get “ProjectManager” Custom Role (single user) and Set Owner with the same user
my $pm = $self->TicketObj->CustomRole.{‘ProjectManager’};
my ($status, $msg) = $self->TicketObj->SetOwner($pm);
but does’nt work. Any idea?
Thanks
Assuming your users have email addresses you can use the following:
my $custom_role = RT::CustomRole->new( $self->TicketObj->CurrentUser );
my ( $ret, $msg ) = $custom_role->Load( 'ProjectManager' );
RT::Logger->error ( "Could not load custom role 'PM' : $msg" ) unless $ret;
my $user = $self->TicketObj->RoleAddresses( $custom_role->GroupType );
Working perfectly, the code get the email address, then I can insert as Owner.
Thanks a lot!