[Rt-devel] using ___Approvals queue
Ronan Le Normand
ronan.le.normand at gmail.com
Mon May 28 12:13:55 EDT 2007
I am using RT for a couple of weeks and I have to allow an unknown user to
create a ticket without an account.
Submitting user information and request, the user is created and the ticket
is supposed to be approved by the administrator.
It's like a registration and first time ticket creation all in one.
I am using the RT API to write Perl interface opened to the public where
user and request information are submitted
and I am trying to use the ___Approvals queue to manage the ticket and
automatically email the administrator
that he needs to review it before approving user account and give him RT
Is using this queue the right way to go?
I cannot find documentation on the Approval queue which seems to offer what
i am looking for.
I have enabled the queue and entered the administrator email address in the
Reply-to and Comment fields as well as adding it as a watcher.
Nevertheless, I am failing to generate the right email using the 'Pending
for approval' template to the administrator (the wanted owner of the
I only get the 'ticket created' email.
Also i dont know how to use the RT API to put a Comment with the description
of the ticket.
Thank you for any information you could provide,
Here is the code I wrote so far:
my $UserObj = new RT::User( $RT::SystemUser );
# Creates new user
# my ($id, $message) =
# $UserObj->SetComments('Waiting for account approval');
my ($id, $message) = $UserObj->Create(
Name => param('Name')
,Password => param('Password')
,Comments => 'Waiting for account approval'
,EmailAddress => param('EmailAddress')
,Organization => param('Organization')
,RealName => $RealName
,NickName => param('RealName_1')
,WorkPhone => param('WorkPhone')
,Address1 => (param('Address1') || '')
,Address2 => (param('Address2') || '')
,City => (param('City') || '')
,State => (param('State') || '')
,Zip => (param('Zip') || '')
,Country => (param('Country') || '')
my $CurrentUserObj = new RT::CurrentUser();
$CurrentUserObj->Load( $UserObj->Id );
# Load user root
my $UserRootObj = new RT::User( $RT::SystemUser );
$UserRootObj->Load( 'root' );
# Load queue
my $QueueObj = new RT::Queue( $RT::SystemUser );
$QueueObj->Load( '___Approvals' );
# Create ticket with question
# my $TicketObj = $UserObj->Ticket;
# my $current_user = $TicketObj->CurrentUser;
# $TicketObj->CurrentUser( $RT::SystemUser );
my $TicketObj = new RT::Ticket( $RT::SystemUser );
my ($id, $message) = $TicketObj->Create(
Queue => $QueueObj->Id
,Subject => $request # ("First time request for
,Requestor => $UserObj->Id
,Owner => $UserRootObj->Id
#,LastUpdatedBy => $UserObj->Id
#,Cc => $UserObj->Id
#,AdminCc => $UserRootObj->Id
#,Creator => $UserObj->Id
$TicketObj->CurrentUser( $CurrentUserObj );
Ronan Le Normand
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Rt-devel