[rt-users] Setting the Requestor to be the CurrentUser in a created ticket

Kevin Falcone falcone at bestpractical.com
Tue May 31 11:39:00 EDT 2011


On Tue, May 31, 2011 at 05:32:35PM +0200, Gerard FENELON wrote:
>    Hello
> 
>    I am creating tickets automatically when a CF is set to a specific value
> 
>    I would like to to put the name of the User that changes the CF value in the Content.
>    I would also like to set the Requestor of the new ticket to be the User that changes the CF
>    value
>    I have been unable to find a way to do that (I searched the wiki)

Assuming a new enough RT (3.8.9 I think) you can use $TransactionObj
to get the CreatorObj of the transaction that triggered your Scrip.
That is the correct way to figure out who caused something.

-kevin

>    The (simplified) template to create that new ticket is below
>    (for the moment I am just trying to get the name of the CurrentUser in the Content part
>    I will set the Requestor once I get that part right)
> 
>    I have tried
> 
>      * new RT::CurrentUser( $session{'CurrentUser'} );
>      * new RT::CurrentUser;
>      * $session{'CurrentUser'}
>      * $Tickets{'TOP'}->CurrentUser
> 
>    none of them seems to give me the expected result
>    (the first three return nothing, the last returns the SystemUser)
>    Can someone help me out ?
> 
>    Thanks
>    Gerard
> 
>    ===Create-Ticket: new_patch_request
>    Queue: Patch Request
>    Subject: patch for RT { $Tickets{'TOP'}->Id() }
>    RefersTo: {  $Tickets{'TOP'}->Id() }
>    CustomField-4:  { $Tickets{'TOP'}->FirstCustomFieldValue( 'SW' ) || "Unknown" ; }
>    Content:
> 
>    { my $current_user = ????? ;
>    $current_user->RealName if $current_user  }
> 
>    is requesting an official patch for ticket { $Tickets{'TOP'}->Id() } (Subject: {
>    $Tickets{'TOP'}->Subject }).
> 
>    ENDOFCONTENT
-------------- 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/20110531/76540cd4/attachment.sig>


More information about the rt-users mailing list