This worked exactly right. I used =~ instead of eq, and otherwise just cut and pasted your code. Thank you so much!! -S
On Thu, May 28, 2009 at 12:02 PM, Raed El-Hames <[email protected]> wrote: > Just finished working on something very similar , I am guessing the top > sales guys would be the one creating a ticket, if this is the case you can > do a scrip: > > > my $CreatorObj = $self->TicketObj->CreatorObj ; > my $org = $CreatorObj->GroupMembership ; > > if ( $org eq 'The group you need') { > $self->TicketObj->SetPriority(80); > } > return undef; > > The function GroupMembership I created in User_Vendor.pm (or > User_Overlay.pm pending which ever you are using): > > sub GroupMembership { > # Identify a group\s a user belong to > # Used in scrip action in queues > > # Expects a user id and return group name > # If user belong to more than one it returns comma seperated list > > my $self = shift; > my $MemberId = $self->Id ; > > my $group_list = ''; > > my $Groups = RT::Groups->new($RT::SystemUser); > $Groups->Limit( FIELD => 'Domain',OPERATOR => '=', VALUE => > 'SystemInternal'); > $Groups->Limit( FIELD => 'Domain',OPERATOR => '=', VALUE => > 'UserDefined'); > > my $alias = $Groups->Join( > TYPE => 'left', > ALIAS1 => 'main', > FIELD1 => 'id', > TABLE2 => 'GroupMembers', > FIELD2 => 'GroupId' > ); > $Groups->Limit( > ALIAS => $alias, > FIELD => 'MemberId', > OPERATOR => '=', > VALUE => $MemberId, > ); > > while ( my $Group = $Groups->Next ) { > $group_list = $group_list.",".$Group->Name ; > > } > $group_list =~ s/^,+// ; > return $group_list ; > } > > > I am not 100% on the SetPriority syntax -you may need to check it--, we do > n't use priority we use custom fields resembling priority. > Also note if the Creator (person) is a member of more than one group then > the $org will be list of group names separated by a comma , in that case you > maybe better off doing: > if ( $org =~ /The group name you need/) { > $self->TicketObj->SetPriority(80); > } > > Regards; > Roy > > > > Steve Hopps wrote: > >> Hi there, at our company there's a group of people who get preferential >> treatment because they're top sales guys, and in order to make it easier on >> our helpdesk techs, I'd like to have their tickets be prioritized >> automatically based on membership to a group. >> >> I'm not sure how to do a check for group membership in a scrip, I've been >> looking through the mail archives but haven't had any luck so far. Can >> anyone recommend how to do this? >> >> Basically I want the scrip to trigger if they're a member, and set the >> priority to something (say 80) on creation, and that's all. Any help would >> be appreciated on this one. Thanks! >> >> -Steve >> >
_______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [email protected] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
