[rt-users] Approval - Custom Action Scrip to create Approval Tickets

Kevin Falcone falcone at bestpractical.com
Tue Mar 9 13:35:58 EST 2010


On Tue, Mar 09, 2010 at 11:34:04AM -0500, Jennifer Koermer wrote:
>    I need to create multiple approval tickets based on content in custom fields of the parent
>    ticket.  Tickets are being created based on the custom field content, approvers are being
>    specified from another custom field.  If multiple approvers are specified, multiple tickets
>    are created.

Since you seem confident enough to turn the standard CreateTickets
template into a scrip action, you may find it useful to read the
documentation and code in lib/RT/Action/CreateTickets.pm for examples
of doing what you want to do.

-kevin

>    I've managed to get almost everything to work using the following in a custom action scrip:
> 
>      my ($child_id, $child_transobj, $errormsg ) =
> 
>          $child_ticket->Create(
> 
>          Queue => $queue_name ,
> 
>          Subject => "Approval for ticket: " . $ticket->id . " - " . $ticket->Subject,
> 
>          Cc => $override_approver,
> 
>          RefersTo => $ticket->id ,
> 
>          DependedOnBy => $ticket->id ,
> 
>          Type => "approval" ,
> 
>          Reqestor => $req_addr,
> 
>          Owner => $approver,
> 
>          AdminCc => $approver,
> 
>        );
> 
> 
> 
>    I still haven't figured out how to add content, set a due date 2 days from now, or set a
>    custom field.
> 
> 
> 
>    Content:
> 
>    I would like the initial content of the ticket to be the following:
> 
> 
> 
>    Approval for $ticket->FirstCustomFieldValue('UserDisplayName')
> 
>    To submit your response via e-mail.  To do so, reply to this message with one of the following
>    responses in the
> 
>    body of the message:
> 
>    To approve:
> 
>         Status: Resolved
> 
> 
> 
>    To reject:
> 
>         Status: Rejected
> 
> 
> 
>    To view the original request, follow this link:
>    RT->Config->Get('WebURL')}Ticket/Display.html?id=$ticket->id
> 
>    ________________________________________________________
> 
> 
> 
>    Additional information is below:
> 
>     $ticket->Transactions->First->Content()
> 
> 
> 
>    I have tried adding both of the following lines into the ticket creation, but the content is
>    not added.  That being said, there are also no errors reported:
> 
>          Text => "The Text Field",
> 
>          Content => "The Content Field",
> 
> 
> 
> 
> 
>    Custom Field:
> 
>    My custom field is ApprovalType.  I have tried the following (based on what is used in
>    templates):
> 
>    CF-ApprovalType => "User"
> 
>    I get the following error
> 
>    [Tue Mar  9 16:22:27 2010] [error]: Scrip 74 Prepare failed: Bareword "CF" not allowed while
>    "strict subs" in use at (eval 3132) line 19. (/usr/lib/rt/RT/Action/UserDefined.pm:64)
> 
> 
> 
> 
> 
>    Due Date:
> 
>    The template that I'm basing this on uses the following line to set the date:
> 
>    Due: {time + 86400}
> 
> 
> 
>    I'm not sure how to set that time within the custom action of a scrip.
> 
>    I tried the following & it didn't work:
> 
>    Due => time + 86400
> 
>    The following error is returned:
> 
>    [Tue Mar  9 16:30:10 2010] [error]: Scrip 74 Prepare failed: Day '68' out of range 1..31 at
>    /usr/lib/rt/RT/Date.pm line 966
> 
> 
> 
>    Anyone have any words of wisdom?
> 
> 
> 
>    Jennifer Koermer
> 
>    Assistant Director of Information Technology
> 
>    ----------------------------------------------------------------------------------------------
> 
>    PRG
> 
>    Production Resource Group
>    7777 West Side Avenue, North Bergen, NJ 07047
>    201-758-4349 phone
>    201-868-7195 fax
> 
>    201-232-7691 cell
>    [1]jkoermer at prg.com
>    [2]www.prg.com
> 
> 
> 
> References
> 
>    Visible links
>    1. mailto:rtooker at prg.com
> 	mailto:jkoermer at prg.com
>    2. http://www.prg.com/
> 	http://www.prg.com/

> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> 
> 2010 RT Training Sessions!
> San Francisco, CA, USA - Feb 22 & 23
> Dublin, Ireland - Mar 15 & 16
> Boston, MA, USA - April 5 & 6
> Washington DC, USA - Oct 25 & 26
> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com

-------------- 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/20100309/84dcc86b/attachment.sig>


More information about the rt-users mailing list