<div>I am using RT for a couple of weeks and I have to allow an unknown user to create a ticket without an account.</div>
<div>Submitting user information and request, the user is created and the ticket is supposed to be approved by the administrator.</div>
<div>It's like a registration and first time ticket creation all in one.</div>
<div> </div>
<div>I am using the RT API to write Perl interface opened to the public where user and request information are submitted</div>
<div>and I am trying to use the <font face="Courier New">___Approvals </font><font face="">queue to manage the ticket and automatically email the administrator </font></div>
<div>that he needs to review it before approving user account and give him RT access.</div>
<div> </div>
<div>Is using this queue the right way to go? </div>
<div>I cannot find documentation on the Approval queue which seems to offer what i am looking for. </div>
<div>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.</div>
<div>Nevertheless, I am failing to generate the right email using the 'Pending for approval' template to the administrator (the wanted owner of the ticket).</div>
<div>I only get the 'ticket created' email. </div>
<div> </div>
<div>Also i dont know how to use the RT API to put a Comment with the description of the ticket.</div>
<div> </div>
<div>Thank you for any information you could provide,</div>
<div> </div>
<div>Here is the code I wrote so far:</div>
<div><br clear="all"><font face="courier new,monospace"><font face="Courier New"> </font>my $UserObj = new RT::User( $RT::SystemUser );</font></div>
<div><br>
<p><font face="courier new,monospace"> # Creates new user<br> #<br> # my ($id, $message) = $UserObj->LoadOrCreateByEmail(param('EmailAddress'));<br> # $UserObj->SetName(param('Name'));
<br> # $UserObj->SetPassword(param('Password'));<br> # $UserObj->SetComments('Waiting for account approval');<br> # $UserObj->Set(param(''));<br>
my ($id, $message) = $UserObj->Create(<br> Name => param('Name')<br> ,Password => param('Password')<br> ,Comments => 'Waiting for account approval'
<br> ,EmailAddress => param('EmailAddress')<br> ,Organization => param('Organization')<br> ,RealName => $RealName<br> ,NickName => param('RealName_1')
<br> ,WorkPhone => param('WorkPhone')<br> ,Address1 => (param('Address1') || '')<br> ,Address2 => (param('Address2') || '')
<br> ,City => (param('City') || '')<br> ,State => (param('State') || '')<br> ,Zip => (param('Zip') || '')
<br> ,Country => (param('Country') || '')<br> );</font></p>
<p><font face="courier new,monospace"> my $CurrentUserObj = new RT::CurrentUser();<br> $CurrentUserObj->Load( $UserObj->Id );</font></p>
<p><font face="courier new,monospace"> # Load user root<br> #<br> my $UserRootObj = new RT::User( $RT::SystemUser );<br> $UserRootObj->Load( 'root' );</font></p>
<p><font face="courier new,monospace"> # Load queue<br> #<br> my $QueueObj = new RT::Queue( $RT::SystemUser );<br> $QueueObj->Load( '___Approvals' );</font></p>
<p><font face="courier new,monospace"> # Create ticket with question<br> #<br> # my $TicketObj = $UserObj->Ticket;<br> # my $current_user = $TicketObj->CurrentUser;<br> # $TicketObj->CurrentUser( $RT::SystemUser );
<br> my $TicketObj = new RT::Ticket( $RT::SystemUser );<br> my ($id, $message) = $TicketObj->Create(<br> Queue => $QueueObj->Id<br> ,Subject => $request # ("First time request for ".$UserObj->Name)
<br> ,Requestor => $UserObj->Id<br> ,Owner => $UserRootObj->Id<br> ,Status =>'open'<br> #,Type =>'approval'
<br> #,LastUpdatedBy => $UserObj->Id<br> #,Cc => $UserObj->Id<br> #,AdminCc => $UserRootObj->Id<br> #,Creator => $UserObj->Id
<br> );<br> $TicketObj->CurrentUser( $CurrentUserObj );</font></p>
<p>-- <br>Regards,<br><br>Ronan Le Normand</p></div>