[rt-users] rt 4.0.4 scrip get current user default queue setting

Kevin Falcone falcone at bestpractical.com
Fri Jan 20 11:07:12 EST 2012


On Thu, Jan 19, 2012 at 09:48:13PM -0500, Jim Lesinski wrote:
>    I am working through a scrip to change change the queue to the current user's default queue
>    setting on Take. I have everything working when setting to a static queue string, but I can't
>    seem to get the current user's default queue value.
>    It seems like it would be something like:
>    $self->TransactionObj->CreatorObj->DefaultQueue;
>    If someone could tell me how I can figure it out that would be great. I would love to know
>    where I can look to find out in the code, or via command line. The Wiki on CreatorObj says "To
>    Be continued'.
>    Maybe I am looking at the wrong class object?

You're looking for a Preference (Config) not a User Attribute;

Generally, if you know you're looking for a Config, you can grep for
the name of the Config and see how it gets used.

$ grep -r DefaultQueue share/html/
share/html/Elements/SelectNewTicketQueue:my $queue = RT->Config->Get("DefaultQueue", $session{'CurrentUser'});
share/html/Elements/SelectNewTicketQueue:if (RT->Config->Get("RememberDefaultQueue", $session{'CurrentUser'})) {
share/html/Elements/SelectNewTicketQueue:    if (my $session_default = $session{'DefaultQueue'}) {
share/html/Elements/SelectNewTicketQueue:$m->callback(Queue => \$queue, CallbackName => 'DefaultQueue');
share/html/Ticket/Create.html:$session{DefaultQueue} = $Queue;

In your case, you need to pay special attention to the two argument
form of RT->Config->Get because you want the value chosen by a user.

RT->Config->Get("DefaultQueue"); # global setting from RT_SiteConfig.pm
RT->Config->Get("DefaultQueue", $current_user); # RT::CurrentUser object returns the value for that user.

-kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120120/65b103a9/attachment.sig>


More information about the rt-users mailing list