[rt-users] Spawn multiple child tickets

Kenneth Crocker kfcrocker at lbl.gov
Wed Jun 9 15:04:36 EDT 2010


Jonathan,

Try something like this:

Condition: User Defined
Action: Create Tickets
Template: Create Child Ticket
Stage: TransactionBatch


Custom Condition:

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;

if  ($trans->Type eq 'CustomField')
    {my $cf = new RT::CustomField($RT::SystemUser);
        $cf->LoadByName(Queue => $ticket->QueueObj->id,
         Name => "YOUR CF");
     return 0 unless $cf->id;
     if  ($trans->Field == $cf->id &&
          $trans->NewValue eq "Florida")
          {
           return 1;
          }
    }

return 0;

That should create the ticket. I think you will need a different scrip for
notification purposes. One notification scrip should suffice for all the
tickets created.

Be sure to use TransactionBatch.

Hope this helps.

Kenn
LBNL

On Wed, Jun 9, 2010 at 10:41 AM, Jonathan Rummel <jrummel at imapp.com> wrote:

>
> That's correct, Kenn.  If they select 3 values, I want 3 child tickets and
> so
> on.  However, that's my main problem.  I've done what you're suggesting (by
> using the code I provided, with one scrip for each state), and it only
> creates a child ticket for the first option selected.  Any ideas?
>
> Jonathan
>
>
>
> Kenneth Crocker wrote:
> >
> > Jonathan,
> >
> > If I understand this right, you want to create a child ticket for every
> > value the user selects in the Custom Field. If they choose Florida and
> > Maine, then you want two child tickets. If they select Florida, you want
> > one. What if they select 3 or 4 values? If this is the case, I would
> > create
> > a scrip for each possible value, that way, no matter how many they
> select,
> > each one will create a child ticket.
> >
> > Kenn
> > LBNL
> >
> > On Wed, Jun 9, 2010 at 9:10 AM, Jonathan Rummel <jrummel at imapp.com>
> wrote:
> >
> >>
> >> Thanks, Kevin.  I'm pretty much doing this on a novice level, and could
> >> use
> >> a
> >> little more explaining if possible.  Please see notes in caps and
> >> parenthesis below:
> >>
> >> Jonathan
> >>
> >> Your condition only checks if the first value is Florida and then
> >> again hardcodes the first value into the ticket creation.  Using
> >> FirstCustomFieldValue is never going to show you the second value.
> >>
> >> (HOW DO I REFERENCE THE 2ND, 3RD, ETC. CUSTOM FIELD VALUES IN MY
> >> CONDITION?
> >> I DON'T SUPPOSE IT'S AS EASY AS "SecondCustomFieldValue".)
> >>
> >> CreateTickets can create multiple tickets by defining them in the
> >> Template with differing ===Create-Ticket: lines (see the pod in the
> >> action) but that requires you to know how many tickets you want.
> >>
> >> (COULD YOU PLEASE EXPLAIN THE ABOVE FURTHER? I'M NOT SURE I COMPLETELY
> >> UNDERSTAND.)
> >>
> >> I believe in the past people have advised that you either write a look
> >> that calls Ticket->Create for each CustomFieldValue, but you should be
> >> able to generate the template entirely within {} for each
> >> CustomFieldValue if you want to go that route.
> >>
> >> -kevin
> >>
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Spawn-multiple-child-tickets-tp28755908p28832522.html
> >> Sent from the Request Tracker - User mailing list archive at Nabble.com.
> >>
> >>
> >> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> >> Buy a copy at http://rtbook.bestpractical.com
> >>
> >
> >
> > Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> > Buy a copy at http://rtbook.bestpractical.com
> >
>
> --
> View this message in context:
> http://old.nabble.com/Spawn-multiple-child-tickets-tp28755908p28833645.html
> Sent from the Request Tracker - User mailing list archive at Nabble.com.
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100609/5d29f14f/attachment.htm>


More information about the rt-users mailing list